Snark's answer's better than my quick 'n dirty effort, since it makes no assumptions about file content.
Follow his advice & ignore mine.
but it just hangs.
cat filname.csv | sed -e :a -e '$!Ns/\n[^"]/&/;ta -e 'P;D' > newfilename.csv
...Out of interest, whence came this script? It doesn't work properly even with Snark's correction.
If you're interested in the post-mortem, there are a few typos in there: the odd number of single quotes means that the thing will go into interactive mode (you need a single quote after the ta); missing a semicolon after the N prompts sed to grumble about "extra characters after command", and lastly the ampersand causes it to grind to a halt after a couple of lines.
If you need some good ready-made SED scripts, this
is a great place (particularly if you're as idle as I am) --- the script you need is a simple modification of this one
# if a line begins with an equal sign, append it to the previous line
# and replace the "=" with a single space
sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D'
(which is listed a couple of screens down the page). It The only modifications to make to it are to swap the = for a [^"] and to mark out the latter as a sub-expression (using \( \) and \1). Which gives you this
sed -e :a -e '$!N;s/\n\([^"]\)/\1/;ta' -e 'P;D'
I should also point out that you won't be able simply to pipe in your file and redirect the output back into the same file, since sed is still reading the file
--- chances are you'll end up with an empty file.
If you want to change the file itself, use the -i switch to edit the file in place:
sed -i -e :a -e '$!N;s/\n\([^"]\)/\1/;ta' -e 'P;D' filename.csv
Hope this answers your question!
Wales over & out.