The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.
Country: (Unknown Country?) (XX) City: (Unknown City?) IP: 112.78.119.61
Country: CHINA (CN) City: Beijing IP: 114.247.18.5
Country: HONG KONG (HK) City: Hong Kong IP: 115.126.5.104
And I want to arrange it nice and alphabetically by country.
So I tried this as a shot in the dark:
ALPHA="( a b c d e f g h i j k l m n o p q r s t u v w x y z"
#grep in geoip_list for 'Country: [$x].*
for x in $ALPHA
do
grep 'Country: [$x].*' geoip_list >> geo_alphabetical
done
but it didn't work. Can I do this, or do I just have to do individual greps for each letter?
I actually tried sort first, but since every line starts with Country: the sort does no good. If I could sort based on a specific field, that would work.
I actually tried sort first, but since every line starts with Country: the sort does no good. If I could sort based on a specific field, that would work.
Could you double check, please? A quick test here shows that sort sorts by the entire line, as opposed to fields:
$ cat geoip_list
Country: HONG KONG (HK) City: Hong Kong IP: 115.126.5.104
Country: CHINA (CN) City: Beijing IP: 114.247.18.5
Country: (Unknown Country?) (XX) City: (Unknown City?) IP: 112.78.119.61
$ sort geoip_list
Country: (Unknown Country?) (XX) City: (Unknown City?) IP: 112.78.119.61
Country: CHINA (CN) City: Beijing IP: 114.247.18.5
Country: HONG KONG (HK) City: Hong Kong IP: 115.126.5.104
Ok, so I have the geo_alphabetical file with all the data, which needs to get dumped into an html file.
right now, I have $HDR defined as my header for the html file, and $FTR likewise for the footer.
before, when I just dumped the data straight into the html after the lynx query for groip info, it came out as one solid line. Trying to cat or echo the file to the html file results in word by word messiness.
Posts
Edit:
e.g. sort geoip_list > geo_alphabetical
Alternatively, if you have lines other than country and only want the lines starting with Country:
grep '^Country: ' geoip_list | sort > geo_alphabetical
See how many books I've read so far in 2010
Could you double check, please? A quick test here shows that sort sorts by the entire line, as opposed to fields:
Lets see how it pans out here in a few.
See how many books I've read so far in 2010
Country: HONG KONG (HK) City: Hong Kong IP: 115.126.5.104
I have
Country:
HONG
KONG
(HK)
City:
...
argh
See how many books I've read so far in 2010
right now, I have $HDR defined as my header for the html file, and $FTR likewise for the footer.
before, when I just dumped the data straight into the html after the lynx query for groip info, it came out as one solid line. Trying to cat or echo the file to the html file results in word by word messiness.
How should I do this?
See how many books I've read so far in 2010
See how many books I've read so far in 2010