rjsha1
August 4, 2006, 4:27am
1
Hi there,
I have a comma seperated file with nine fields
the fields are
rerate: "numberTX",field2,field3,field4,field5.....
I want to do this to the file
reate: "field5TX",field2,field3,field4,field5
I know I can do this using AWK, but the thing giving me fits is that I need to keep the first part of thr first field there. Anyone got any ideas how I would do this ????
rjsha1
August 4, 2006, 4:57am
2
Hi guys,
This is what I have so far
nawk 'BEGIN {OFS=","} $1="Rerate: "$15 {print} ' robtest.txt >robawk.txt2
but it is placing a comma after Rerate: - what am I doing wrong
aigles
August 4, 2006, 5:14am
3
Try !
nawk 'BEGIN {FS="," ;OFS=","} {$1="Rerate: "$5 ;print} ' robtest.txt >robawk.txt2
Jean-Pierre.
rjsha1
August 4, 2006, 5:25am
4
Hi Jean-Pierre,
That's great.. However I have another question, what if the Field seperator is a " as opposed to a , ?????
echo "a\"b\"c" | awk -F'"' '{print $1,$2,$3}' " enclosed in ' '
or
echo "a\"b\"c" | awk -F"\"" '{print $1,$2,$3}' " enclosed in " ", preceeded by a \
rjsha1
August 4, 2006, 5:39am
6
Cheers vish - knew I was missing something - thanks guys for all your help.