The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
sorting csv file based on column selected
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
sorting csv file based on column selected
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
4
(
permalink
)
07-04-2009
scottn
VIP Member
Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,119
Because you said
Quote:
...it may have more columns
A slight modification to vidyadhar85's code
Code:
sort -t";" -k3 -k2 filename|awk -F\; '{A[$NF]=A[$NF]"\n"$0}END{for (i in A) {print toupper(i)A[i]}}'
scottn
View Public Profile
Find all posts by scottn
Find scottn's past nominations received
Find scottn's present nominations given