CSV file is well known MS access and Excel file extract. .csv file use CR/LF as record delimiter and ',' as field delimiter. Normally, the value of the field doens't cotnain either CR nor LF. In case when the value is not key in but copy/paste from other source. CR/LF may contains as field value. To mark it as a field, .csv file quote the field value with '"'.
Here is an example(4 columns)
1,bb,33,55
2,"a
c",66,88
3,aa,xx,kk
4,"Y
YY", dd, "ffff
kk"
All togher there are 4 lines, the first field is record number.
The requirement is:
Replace CR/LF by a space, if it is part of the field value. The following is the result after fix:
1,bb,33,55
2,"a c",66,88
3,aa,xx,kk
4,"Y YY", dd, "ffff kk"
Hint, I used sed to do the fix with N command.
Here is an example(4 columns)
1,bb,33,55
2,"a
c",66,88
3,aa,xx,kk
4,"Y
YY", dd, "ffff
kk"
All togher there are 4 lines, the first field is record number.
The requirement is:
Replace CR/LF by a space, if it is part of the field value. The following is the result after fix:
1,bb,33,55
2,"a c",66,88
3,aa,xx,kk
4,"Y YY", dd, "ffff kk"
Hint, I used sed to do the fix with N command.