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

The same thing written in Perl would be:

perl -ne 'print if /System Temperatures/../=+/' FILENAME


The file in question has text that looks like this:

[snip file sample]

What I'm looking for is a graceful way to do this in a perl script.
I'm kinda at a loss for where to begin.  Can you help me out?

A simple example would be something like this:

#!/usr/bin/perl
use warnings;
use strict;

my $file_in  = 'FILENAME';

open my $IN, '<', $file_in or die "Cannot open $file_in: $!";

while ( <$IN> ) {
    if ( /System Temperatures/ .. /=+/ ) {
        print;
        }
    }

__END__



John
--
use Perl;
program
fulfillment

--
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