Re: Rookie Perl Question
- From: "swangdb" <swangdb@xxxxxxxxxx>
- Date: 30 Jun 2006 13:27:12 -0700
Eric R. Meyers wrote:
swangdb wrote:
This doesn't work, it tries to take the egrep output and cut out part
of it:
***
$temp = "egrep -v \^# $ALIASES | cut -d: -f1";
system($temp);
***
$aliases = 'some/file/name';
open( FH, $aliases ) || die "opening aliases: $!\n";
while ( <FH> )
{
print if ( ! m/^[#]/ );
} ## end while
close( FH );
Eric,
Thanks for showing a real perl way to do this. I received a quick fix
to my command, add one backslash before the existing backslash:
$temp = "egrep -v \\^# $ALIASES | cut -d: -f1";
system($temp);
I actually want to put this output to a file, so I guess system is
okay:
$temp = "egrep -v \\^# $ALIASES | cut -d: -f1 > $outfile";
system($temp);
Thanks again!
.
- References:
- Rookie Perl Question
- From: swangdb
- Re: Rookie Perl Question
- From: Eric R. Meyers
- Rookie Perl Question
- Prev by Date: Re: Professional IDE for a cross-platform Perl application
- Next by Date: Re: Rookie Perl Question
- Previous by thread: Re: Rookie Perl Question
- Next by thread: Re: Rookie Perl Question
- Index(es):