[Kc] RegExes
Jonathan Otsuka
djgoku at gmail.com
Tue Apr 1 10:16:49 PDT 2008
On Apr 1, 2008, at 12:00 PM, Frank Wiles wrote:
> On Mon, 31 Mar 2008 20:34:58 -0500
> "Emmanuel Mejias" <emmanuel.mejias at gmail.com> wrote:
>
>> I think I figured it out. How's that look, better?
>>
>> #!/usr/bin/perl -w
>>
>> @input = `cat /etc/syslog.conf`;
>>
>> foreach $line (@input) {
>> if ($line =~* /\var\/log/*){
>> print $line;
>> }
>> }
>>
>
> The asterisks there aren't correct. It should be like this:
>
> if( $line =~ /\/var\/log\// ) {
> print $line;
> }
I was thinking since one of the lines in syslog.conf had a -prepended.
So:
if($line =~ /.*\/var\/log\//) {
print $line;
}
More information about the kc
mailing list