How to sort a file by its columns

Jun 04
2009
# sort by user id
ruby -a -F: -ne 'puts $F.values_at(2, 0).join("\t")' '/etc/passwd' | sort -g
 
# sort by user home directory
ruby -a -F: -ne 'puts $F.values_at(5, 0).join("\t")' '/etc/passwd' | sort -g
 
# sort by username
ruby -a -F: -ne 'puts $F.values_at(0).join("\t")' '/etc/passwd' | sort -g

Comments are closed.

Calendar

June 2009
M T W T F S S
« May   Jul »
1234567
891011121314
15161718192021
22232425262728
2930  

Tags