top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Remove inbuild commas from CSV.

+2 votes
397 views

I have csv file , all the values of column is separated by "," .
Some column have embedded comma "," . How can i Remove these embedded commas
These embedded commas creating problems to extract value from csv file.
I am using shell script.

posted Oct 14, 2013 by Vikas Upadhyay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Try something like this -

tmpFile=$input"Temp"
sed 's/\(\"\)\(.*\)\(,\)\(.*\)\(\"\)/\1\2\3\4/'  < $input > $tmpFile
cp $tmpFile $input
rm $tmpFile
answer Oct 15, 2013 by Salil Agrawal
Similar Questions
+2 votes

In excel_sheet.xls some cell contains newline character.
I created cvs (excel_sheet.cvs) form xls. In this cvs same row is divided in two row because of new line character in cell value. I want to extract values from CVS.

0 votes

how to raise a shell script to raise an alarm o the Linux system when the system disk space exceeds the 90% usage

...