in reply to Re: How can I remove 0 from first line and empty space from the start of the following line and join them
in thread How can I remove 0 from first line and empty space from the start of the following line and join them
is not to even loop at all.while (<DATA>) { $_ .= <DATA>; s/^0\s*(.*)\n\s+(.*\n)/$1 $2/s; print; }
caveat is that it eats up memory if you have an extremely large file.{ local $/ = undef; $_ = <DATA>; s/^0\s*(.*)\n\s+(.*\n)/$1 $2/s; print; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: How can I remove 0 from first line and empty space from the start of the following line and join them
by BrowserUk (Patriarch) on Oct 16, 2002 at 02:40 UTC |