I have a .CSV file with 7 fields, and the 3rd and 4th columns of the file has a number starting with an apostrophe ( ' ). Please see the example below.
col0,col1,col2,col3,col4,col5,col6,
1value0,1value1,'8972991766941,'8972991766941,1value4,1value5,1value6,
2value0,2value1,'8912988876583,'8912988876583,2value4,2value5,2value6,
3value,3value1,'8912981226981,'8912981226981,3value4,3value5,3value6,
2value0,4value1,'8912971783681,'8912971783681,4value4,4value5,4value6,
How do I get rid of the apostrophes in the 3rd and 4th columns only using either sed or awk?
Best Answer
You can do it with
awk
, The idea is to run a substitute command on columns 3 and 4 to replace the single quote with a blank. Here\047
represents the octal code for'
.