Taylor Lewick wrote:
>
> From: John W. Krahn [mailto:krahnj@acm.org]
> >
> > Taylor Lewick wrote:
> > >
> > > Okay, I redid it so it looks like this...
> > >
> > > `grep -v "STUFF:STUFF" file1 > file2`;
> >
> > Is that what the ACTUAL line looks like?
> >
> > > (I am looking for the string
> > > STUFF:STUFF and that didn't work... but it works via command line...
> > >
> > > Any ideas?
> >
> > Use perl to do it:
> >
> > open my $in, '<', 'file1' or die "Cannot open file1: $!";
> > open my $out, '>', 'file2' or die "Cannot open file2: $!";
> > while ( <$in> ) {
> > next if /STUFF:STUFF/;
> > print $out;
> > }
> > close $out;
> > close $in;
>
> Okay, will do... One more, what about a sed command that deletes the
> first 3 spaces of each line... i.e., how would I do this in perl...
>
> sed 's/^ //' file1 > file2
open my $in, '<', 'file1' or die "Cannot open file1: $!";
open my $out, '>', 'file2' or die "Cannot open file2: $!";
while ( <$in> ) {
s/^ //;
print $out;
}
close $out;
close $in;



John
--
use Perl;
program
fulfillment