[Kc] Need second look at this...

Emmanuel Mejias emmanuel.mejias at gmail.com
Thu Oct 11 13:58:25 PDT 2007


On 10/11/07, djgoku <djgoku at gmail.com> wrote:
>
> On 10/11/07, Emmanuel Mejias <emmanuel.mejias at gmail.com> wrote:
> > trying to grep out some info from my /etc/hosts file...just to get more
> > practice with Perl and well for my personal pleasure, too.
> >
> > #!/usr/bin/perl
> >
> > open (FILE, "/etc/hosts");
> > @lines = <FILE>;
> > close (FILE);
> >
> > foreach $line (@lines){
> >    if ($line =~ /pm1/){
> >       print $line;
> >    }
> > }
> >
> >
> > the problem with this is that it's printing out some hosts that i don't
> want
> > that also have pm1 at the end.
> >
> > somehostpm1 but it also gets my dr hosts (dr-somehostpm1)
> >
> > thoughts?
>
> Are the ones you don't want all have a prefix of 'dr-'? Can we get a
> sample list?


correct!
cnxxpm1
cnxypm1
cnxzpm1

dr-cnxxpm1
dr-cnxypm1
dr-cnxzpm1
dr-cnabpm1
dr-cncdpm1


> by the way, i had to jump the wifes car so i ended up missing out on the
> > meeting. gonna try to make the next one for sure, though.
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20071011/3241bcdf/attachment.html 


More information about the kc mailing list