I'm trying to sort a file that has entries that look like so:
Essie | Vaill | 14225 Hancock Dr | Anchorage | AK | 99515 907-345-0962
Please note the "|" stand for tabs of various sizes. I'm trying to sort this by the second field which in this case are last names in alphabetical order. I've tried several different commands such as (note addresses.txt is the name of the file):
sort -k 2 addresses.txt
sort -t$'\t' -k2 addresses.txt
sort -t "`/bin/echo '\t'`" -k 2 addresses.txt
None of these are giving me the desired result and after searching the internet, I simply cannot find a solution that works the way I need it to. If anyone could help me find the way to sort these by the second column in alphabetical order, it would be greatly appreciated.
sort -k2,2 addresses.txt
?