On Aug 13, 2004, at 8:19 AM, Errin Larsen wrote:

Hey guys (and gals, I imagine!),

Hello.

I'm really new to perl. I've been working through some beginners
tutorials and now I need (want!) to use perl to overhaul something I
wrote in the past.  I've got a script (in bash) that I use that has a
particular sed command in it.  The command is as follows:

sed -n '/System Temperatures/,/==*/p' FILENAME

Here's the Perl equivalent:

perl -ne 'print if /^System Temperatures/../^==/' data.txt

The only tricky thing in there is the .., which is the range operator. When called in scalar context, as it is here in the if conditional, it returns true when on a line between (inclusive) the two expressions.

Hope that helps.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to