On Dec 2, 2003, at 10:44 AM, David T-G wrote:

Hi, all --

I have some database sql dumps that look like

insert into table (f1,f2,f3) values (v1a,v2a,v3a),(v1b,v2b,v3b),...

where of course the insert lines are whopping long.  I would like to
break these lines at the commas like

  insert into table (f1,f2,f3) values (v1a,v2a,v3a),
  (v1b,v2b,v3b),
  ...

(and in fact split after 'values ' but that will just be an exercise on
the first solution) but can't figure out how to spit out the newline.
This *should* be a quick oneliner like

cat file | perl -ew ' ... ' > file.mod

but I just can't get it :-)

Try:


perl -pe 's/\),\s*/),\n/' old_file.txt > file.mod

It's pretty naive, but I may get lucky. ;)

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to