[geeks] awk q: sorting on two different fields
Patrick Giagnocavo
patrick at zill.net
Sat Jul 29 18:58:01 CDT 2006
The combined brainpower of this list will no doubt make short work on
this awk question ....
I am doing a directory for a non-profit organization. I am able to
pre-process the CSV-like file and output to Postscript.
However, what is really desired is for the data to be sorted on two
different fields, alpha by $city and then alpha by $orgname in that
city.
e.g. given a hypothetical data set like
Founder's Harvest, Philadelphia
Lancaster Market, Lancaster
John's Market, Lancaster
Vento's Organic Cheese Steaks, Philadelphia
I would end up with :
(Lancaster sorts before Philadelphia)
(Founder's appears alpha sorted before Vento's)
John's Market, Lancaster
Lancaster Market, Lancaster
Founder's Harvest, Philadelphia
Vento's Organic Cheese Steaks, Philadelphia
Any idea how to do this in awk?
I already have their directory broken out by state, just need to sort
within the state by city and organization name.
--Patrick
More information about the geeks
mailing list