Trying to sort on two fields, second then first

view full story

http://unix.stackexchange.com – I am trying to sort on multiple columns. The results are not as expected. Here's my data (people.txt): Simon Strange 62 Pete Brown 37 Mark Brown 46 Stefan Heinz 52 Tony Bedford 50 John Strange 51 Fred Bloggs 22 James Bedford 21 Emily Bedford 18 Ana Villamor 44 Alice Villamor 50 Francis Chepstow 56 The following works correctly: bash-3.2$ sort -k2 -k3 <people.txt Emily Bedford 18 (HowTos)