Replace help

Hi experts,

I have a csv file where the delimiter is comma and the text between apostrophe.

Like this:

"aaa","bbb","ccc","ddd","eee","fff","ggg"

But now i have a lot of enter(end of line) in text like this:

"aaa","bbb","ccc","ddd","eee","
""
""
fff","ggg"

How can i remove that enters and make my line like the firs example?

Thank You for Your help!

try

$ cat file
"aaa","bbb","ccc","ddd","eee","
""
""
fff","ggg"

if you have to remove empty line use this

$ awk '!/^""$/'  file

resulting

"aaa","bbb","ccc","ddd","eee","
fff","ggg"

if you need everything in one line use below one

$ awk '!/^""$/{printf $0}END{printf RS}'  file

resulting

"aaa","bbb","ccc","ddd","eee","fff","ggg"
paste -s filename | sed 's/""//g;s/"\s\+/"/g'

thanks its work by 1 line file.

Can you help what can i do, if i have a file with 1 million lines which include 15 bad characters(apostrophe and enter).

Hi snayper,

Could you please provide part of input file ?

Thanks
Pravin

sure:

"2721348","2013-10-06","2013-10-06 15:54:37","Tree","1","0","1","1","paper","sumer","","ppd","no","no","anonymous","195","oo","Seria SP, kete","000000000126 ","Red 4","","","","","","","","","2013-10-06 15:57:59","107","","","","7763","Egg","sg","a","27"," ep,  ,  Ajt","73","Eger","yes","a","27","let,  Emelet,  Ajt","76","Eger","Ipol","ca","27","let,  Emelet,  Aj","","","","","","","","","","Sen","rea","Sea","Pcs","","1731","","mar","rtya","5755","","460","","","knes","","","0382323422919","ignhu","
""
""
""
","","0","","","","micro","","","","","","","","","","","","",""
"3621123","2013-10-06","2013-10-06 07:07:23","Szabina","1","0","1","0","zala","coer","ice","paid","no","no","anonymous","","oo","CsaIM","noim","Red 24","","","","","","","","","2013-10-06 07:07:56","107","","","","3529","Miskolc","yi Istv","ua","29","let","32","lc","Ac","ua","2","","32","Mc","Ac","ua","2"," let,  let,  ","","","","","","","","","","Cs","Sina","","kol","","116","","myar","","599452PA","","388304RL","","","","","","3254608134","srohu","","","0","","","","mini","","","","","","","","","","","","",""

that is two row which include one of bad.

awk '!/^""$/ {
if ( $0 ~ /^"[^,].+/) { printf NR==1?$0:"\n"$0} else { printf $0}
} END { printf  "\n"} ' filename

not work:(

awk '!/^""$/ {if ( $0 ~ /^"[^,].+/) { printf NR==1?$0:"\n"$0} else { printf $0}} END { printf  "\n"} ' file.lis
awk: syntax error near line 1
awk: illegal statement near line 1

maybe important but i'm use solaris 5.10

need to use

 /usr/xpg4/bin/awk , /usr/xpg6/bin/awk , or nawk 

instead of awk