Mailing List
Home
Forum Home
Linux - General Red Hat Linux discussion list
Enterprise Linux 3 - Discussion of Red Hat Enterprise Linux 3 (Taroon)
Installation - Getting started with Red Hat Linux
Red Hat Linux 9 - Discussion of Red Hat Linux 9 (Shrike)
Red Hat Linux 7.3 - Discussion of Red Hat Linux 7.3 (Valhalla)
Red Hat Linux 7.2 - Discussion of Red Hat Linux 7.2 (Enigma)
Apache Web Server
Oracle database, Microsoft SQL server ...
Subjects
application/x mplayer2 plugin
RPM error: db4 error(16) from dbenv >remove: Device or resource
   busy
Command stream end of file while reading
X Windows problem (xauth)
Upgrading openoffice 1 1 rpm
FTP: connection refused
FTP: connection refused
mount: /dev/cdrom: is not a valid block device
Dell Precision 650, RedHat 9, no sound
how to trace the cause resulting in the crash of bind server
Virus on the list
UNINSTALL RPM MYSQL
usb pen drives: mounting as a user
broadcom network interface
make mrproper
sendmail configuration on redhat
Couldn 't open PID file /var/run/named/named pid Permission denied
Promise 378 controller
kernel 2 6 and /dev/sound/mixer not found
Problem using up2date
mrtg step by step howto/configuration for a newbie?
Compiling and Installing Kernel 2 6
Can 't locate module ppp0, can 't locate module ppp compress 21
HOW I CAN MAKE BOOTABLE FLOPPY DISKET
Lotus Notes under Wine
/etc/security/limits conf question
Intel E/1000 driver
Command stream end of file while reading
rpm database corrupt
qla2300 modules
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
parsing files

parsing files

2005-07-11       - By Foreman, Tim

 Back
Reply:     1     2     3  

> -- --Original Message-- --
> From: Steve Buehler [mailto:steve@(protected)]
> Sent: Monday, July 11, 2005 10:51 AM
> To: redhat-list@(protected)
> 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 @(protected) and report to me just the "pwd" of the file and
> the lines in them that contain @(protected)
>   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@(protected)
> localname2 name2@(protected)
>
> domain9.net
> localname3 name3@(protected)
> localname4 name4@(protected)
>
> 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 "@(protected)" $I
done

---- END ----

That should do it.

--
Timothy W. Foreman    ~   Security Administrator    ~    tforeman@(protected)
    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@(protected)?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

Earn $52 per hosting referral at Lunarpages.