Ever wanted to look at a long HTML URL more easily, say to investigate a parameter. Here is a search from MapQuest.
http://www.mapquest.com/maps/map.adp?formtype=address&addtohistory=&address=10%20Market%20St&city=San%20Francisco&state=CA&zipcode=94111%2d4801&country=US&geodiff=1
$ echo "[insert url here]" | | tr "&?" "n"
This produced for the above URL the following output.
http://www.mapquest.com/maps/map.adp
formtype=address
addtohistory=
address=10%20Market%20St
city=San%20Francisco
state=CA
zipcode=94111%2d4801
country=US
geodiff=1
The Translate command tr does however replace both the & and ? characters. There are of course many more approaches like.
echo "[insert url here]" | sed -e "s/&/\n/g" -e "s/?/\n/g"
You can easily preserve the & and ? characters extending the syntax with
echo "[insert url here]" | sed -e "s/&/\n&/g" -e "s/?/\n?/g
This produces.
http://www.mapquest.com/maps/map.adp
?formtype=address
&addtohistory=
&address=10%20Market%20St
&city=San%20Francisco
&state=CA
&zipcode=94111%2d4801
&country=US
&geodiff=1
Now don’t get me started with the awk command. One of my popular books is Sed & Awk. If you do any detailed Shell scripting, this is a very handy guide.