parsing files

Steve Buehler steve at ibapp.com
Mon Jul 11 18:22:51 UTC 2005


Thanks.  I don't know why I didn't think of doing it this way.  I 
just had a command line of "grep" stuck in my head instead of putting 
it into a script.
Thanks
Steve

At 12:58 PM 7/11/2005, Foreman, Tim wrote:
> > -----Original Message-----
> > From: Steve Buehler [mailto:steve at ibapp.com]
> > Sent: Monday, July 11, 2005 10:51 AM
> > To: redhat-list at redhat.com
> > Subject: parsing files
> >
> >
> >       Running RedHat 7.3, 8, 9, ES 3 & ES 4.  Does anybody know of a
> > script or just a command line command that I can use to parse a bunch
> > of files for @aol.com and report to me just the "pwd" of the file and
> > the lines in them that contain @aol.com
> >       I think grep or egrep can do this, but for some reason,
> > I cannot get
> > the correct syntax down.  It needs to do something like:
> > grep /home/virtual/*/etc/aliases
> >       Ideally, I would want what the asterisks instead of the
> > "pwd" to the
> > file since that is the part that will tell me what domain it is
> > on.  So the report could be something like this:
> >
> > #root>grep /home/virtual/*/etc/aliases
> > domain1.com
> > localname name at aol.com
> > localname2 name2 at aol.com
> >
> > domain9.net
> > localname3 name3 at aol.com
> > localname4 name4 at aol.com
> >
> > Thanks In Advance
> > Steve
>
>
>The simplest answer is probably to build a quick FOR loop like this:
>
>---- START ----
>#!/bin/sh
>
>for I in `ls /home/virtual/*/etc/aliases`
>do
>   echo $I
>   grep "@aol.com" $I
>done
>
>---- END ----
>
>That should do it.
>
>--
>Timothy W. Foreman    ~   Security Administrator    ~    tforeman at ibsys.com
>      Internet Broadcasting ~ (651) 365-4181 ~ http://www.ibsys.com/
>--
>"Let's get this mother outta here." - The last words spoken on the moon,
>  by Gene Cernan
>
>--
>redhat-list mailing list
>unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
>https://www.redhat.com/mailman/listinfo/redhat-list




More information about the redhat-list mailing list