QA checks out, it does work with the data supplied. (Naivete will have to checked with the real data.)
You could add some nice indent formatting if you like by adding a tab to Jame's expression: s/\),\s*/),\n\t/ -Tom Kinzer -----Original Message----- From: James Edward Gray II [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 8:52 AM To: David T-G Cc: '[EMAIL PROTECTED]' List Subject: Re: breaking lines with perl 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]