using sort command

R Kimber richardkimber at btinternet.com
Mon Apr 26 15:44:07 UTC 2010


I'm trying to sort a text file of the form:
john smith, something, something

Basically, I want to sort on the surname and then on the first name, so
that all the Smiths (e.g.) end up in order of their first name.

The man page doesn't seem to explain this. Googling suggests that

sort -k2 -k1 <filename>

ought to work, but it just seems to sort on the surname.

I'd be grateful for pointers on how to do this.
- Richard.
-- 
Richard Kimber
Political Science Resources: UK General Election 2010
http://www.PoliticsResources.net/area/uk/ge10/ge10.php




More information about the ubuntu-users mailing list