The quick and dirty way to manipulate CSVs from the Shell.
Say you want to create a new CSV subset file with just two specific fields from the original CSV. The one liner code is:
awk -F\, '{printf "%s,%s\n",$1,$3}' original.csv > new.csv
How about sorting on the second field?
cat new.csv | awk -F\, '{printf "%s,%s\n",$1,$2}' | sort -t, -k 2 > newsorted.csv
0 Comments:
Post a Comment