Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

moving fields in a csv file 1

Status
Not open for further replies.

ianicr

IS-IT--Management
Nov 4, 2003
230
GB
Does anyone know of an easy way to move fields around in a csv file? eg. I have a file with
1,2,3,4
and I want to change it to
4,1,2,3

Thanks
 
awk 'BEGIN{FS=OFS=","}{print $4,$1,$2,$3}' infile > outfile
 
Perfect mate. Thanks a lot. I'm lovin awk its amazing!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top