I have a csv file which has 2 columns id, notetext. In second column (notetext), data comes in multiple lines. What I want is to bring all data in one line.
Here is sample:
**catalog_SID, Note_Text**
584,"Sample in a Glove Bag only. Refer to SOP
489-701 for sampling
great
procedure."
647,"Do not use
hotplate"
680,Sample in a Glove Bag
What I need is all data in notetext in one line like these:
**catalog_SID, Note_Text**
584,"Sample in a Glove Bag only.Refer to SOP 489-701 for sampling."
647,"Do not use hotplate"
680,Sample in a Glove Bag
Any idea how to accomplish this?
Just read the whole file and replace all newlines with spaces if they are not followed by digits and a comma
perl -0777 -pe's/\n(?!\d+,)/ /g' myfile
output
catalog_SID, Note_Text
584,"Sample in a Glove Bag only. Refer to SOP 489-701 for sampling great procedure."
647,"Do not use hotplate"
680,Sample in a Glove Bag