At 12:33 PM 6/20/01 -0400, Yacketta, Ronald wrote:
>Folks,
>
>I have been looking for a little regex that would remove NULL (blank) lines
>from input.
>I have a little script that parses the output of timex (unix), unfortuanly
>the timex output
>is prepended with a blank line and appended with a blank line as such
>
>(timex ps -ef > /dev/nul) 2>&1
>
>[begin output]
>
>real    0.00
>user    0.00
>sys     0.0
>
>[end output]


my $timex = `(timex ps -ef > /dev/null) 2>&1`;  # /dev/null has 2 ells on 
my system
$timex =~ tr/\n//s;   # Embedded and trailing blank lines
$timex =~ s/^\n//;    # Leading blank line

Yeah, someone'll come up with a way of doing them all in one statement... 
but this is more understandable to a beginner.

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com

Reply via email to