Re: Help! Perl Substitution

2004-02-19 Thread Jeff Westman
WC -Sx- Jones <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > > When I ran this > > > >$ perl -ne 's/|^NEWLINE^|^/\n/g;print' loadFile > > The program loads the ENTIRE loadfile and then splits characters > at > whitespace "between" characters and then prints every character > followe

Re: Help! Perl Substitution

2004-02-19 Thread WC -Sx- Jones
Jeff Westman wrote: When I ran this $ perl -ne 's/|^NEWLINE^|^/\n/g;print' loadFile The program loads the ENTIRE loadfile and then splits characters at whitespace "between" characters and then prints every character followed by a newline. So, how big is loadfile? __Sx_

Re: Help! Perl Substitution

2004-02-19 Thread Jeff Westman
Paul Johnson <[EMAIL PROTECTED]> wrote: > On Thu, Feb 19, 2004 at 04:36:55PM -0800, david wrote: > > Jeff Westman wrote: > > > > > I'm trying to help out another developer with a mini-Perl > script. > > > He has a file that contains one very long line, about 28M in > size. > > > He needs to do a

Re: Help! Perl Substitution

2004-02-19 Thread david
Paul Johnson wrote: >> >> [panda]# perl -ne 'BEGIN{$/=\10} s/\|\^NEWLINE\^\|\^/\n/g; print' >> [loadFile > > The trouble with this approach is that you will miss any separators > which are split. Your example actually reads 10 bytes at a time, but > using $/ is the right idea: > > perl -ple

Re: Help! Perl Substitution

2004-02-19 Thread Paul Johnson
On Thu, Feb 19, 2004 at 04:36:55PM -0800, david wrote: > Jeff Westman wrote: > > > I'm trying to help out another developer with a mini-Perl script. > > He has a file that contains one very long line, about 28M in size. > > He needs to do a replacement of all occurances of > > > > |^NEWLINE^|

Re: Help! Perl Substitution

2004-02-19 Thread david
Jeff Westman wrote: > I'm trying to help out another developer with a mini-Perl script. > He has a file that contains one very long line, about 28M in size. > He needs to do a replacement of all occurances of > > |^NEWLINE^|^ > > to a literal newline (HPUX, 0x0a or "\n"). > > When I ran thi

Help! Perl Substitution

2004-02-19 Thread Jeff Westman
I'm trying to help out another developer with a mini-Perl script. He has a file that contains one very long line, about 28M in size. He needs to do a replacement of all occurances of |^NEWLINE^|^ to a literal newline (HPUX, 0x0a or "\n"). When I ran this $ perl -ne 's/|^NEWLINE^|^/\n/