I am using sed to match patterns in csv File. The csv file is as follows:
"VALUE";"VALUE";"VALUE";"V
ALUE";....
...
to replace a value i use:
sed '2,4621s/[^;]*;/"'"$VALUE"
'";/11' < file.csv
this works pretty fine if there is only one value given lets say:
VALUE=TEST
sed '2,4621s/[^;]*;/"'"$VALUE"
'";/11' < file.csv
this replaces the 11th VALUE in every line from 2 to 4621 with TEST
but now i have a file2 where other values are stored. It's stored in this format
VALUE
VALUE
VALUE
VALUE
Now i want to read the values from the file above and replace it in the csv file
i tried this:
while read VALUE
do
V=`sed '2,4621s/[^;]*;/"'"$VALUE"
'";/11' < file.csv`
echo $V > new_file.csv
done<file2<<EOF
but somehow this outputs only empty space on the place where the values of file2 should be inserted
"VALUE";"VALUE";"VALUE";"E
MPTY SPACE";"VALUE";.......
I tried many things and played around but without luck
i am using ubuntu hardy heron....
thx alot
Start Free Trial