Current file:
<code>COl1,COl2,COl3,COl4,COL5
AAA1,AAA1,AAA1,AAA1,AAA1
BBB10,BB11
,BB22,BB33
BB44
CCCC,CCC1,CCC2,CCC3
,CCC4,CCC5
</code>
<code>COl1,COl2,COl3,COl4,COL5
AAA1,AAA1,AAA1,AAA1,AAA1
BBB10,BB11
,BB22,BB33
BB44
CCCC,CCC1,CCC2,CCC3
,CCC4,CCC5
</code>
COl1,COl2,COl3,COl4,COL5
AAA1,AAA1,AAA1,AAA1,AAA1
BBB10,BB11
,BB22,BB33
BB44
CCCC,CCC1,CCC2,CCC3
,CCC4,CCC5
Expected:
<code>COl1,COl2,COl3,COl4,COL5
AAA1,AAA1,AAA1,AAA1,AAA1
BBB10,BB11,BB22,BB33,BB44
CCCC,CCC1,CCC2,CCC3
</code>
<code>COl1,COl2,COl3,COl4,COL5
AAA1,AAA1,AAA1,AAA1,AAA1
BBB10,BB11,BB22,BB33,BB44
CCCC,CCC1,CCC2,CCC3
</code>
COl1,COl2,COl3,COl4,COL5
AAA1,AAA1,AAA1,AAA1,AAA1
BBB10,BB11,BB22,BB33,BB44
CCCC,CCC1,CCC2,CCC3
Looking for something to
- check line feed and next line starting with comma then remove the linefeed
- check line feed and next line starting/not starting with a pattern then remove the next line feed.
preferrably with sed.
The source is having unwanted linefeed in between strings and do not have double quotes for the boundary of string.
Tried the below, but it didn’t work:
<code>sed -z -i 's/n,*/.../g' filename
</code>
<code>sed -z -i 's/n,*/.../g' filename
</code>
sed -z -i 's/n,*/.../g' filename