modify contents of csv file

May 17, 2009 at 23:33:12
Specs: UNIX
date,a1,a2,a3
01/11/2000,100,200,300
02/11/2000,400,500,600
03/11/2000,700,800,900

The new file should have contents like this
01/11/2000,a1,100
01/11/2000,a2,200
01/11/2000,a3,300
02/11/2000,a1,400
02/11/2000,a2,500
02/11/2000,a3,600
03/11/2000,a1,700
03/11/2000,a2,800
03/11/2000,a3,900


See More: modify contents of csv file

Report •


#1
May 17, 2009 at 23:35:12
I require to create a new file with the above format in unix..in a hurry ..pls post the shell script to process this file.

Report •

#2
May 18, 2009 at 18:08:18
you are not putting in effort.. what have you got?

Report •

#3
May 27, 2009 at 10:42:29
awk -F "," ' {
if (NR==1) split($0,a);
else
for (i=2;i<=4;i++)
printf"%s,%s,%s\n",$1,a[i],$i;
} ' inputfile

Report •

Related Solutions


Ask Question