Re: Passthru with Grep and Awk?

From: Date: Fri, 16 Jan 2004 01:13:32 +0000
Subject: Re: Passthru with Grep and Awk?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-174747@lists.php.net to get a copy of this message
On Thu, 2004-01-15 at 17:06, Carlton L. Whitmore wrote: > I'm having problems getting the following passthru statement to work. It > works fine with the just the grep command. > Help!!!! > > <?php > echo "<pre>\n"; > passthru('/usr/bin/grep " c=2048" " c=32" " c=2" > /var/log/messages | > /usr/bin/awk "{print $1 $3 $5}" '); > ?> That's not going to do what your thinking it will. Use egrep instead. $ egrep 'c-2048 | c=32 | c=2' /var/log/messages However you can do what you want with just awk, no need to involve (e)grep. $ cat /var/log/messages | awk '/c=2048|c=32|c-2/ {print $1 $3 $5}' -- Brian GnuPG -> KeyID: 0x04A4F0DC | URL: www.gfx-design.com/keys Key Server: pgp.mit.edu ====================================================================== gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC GnuPG: http://gnupg.org http://www.biglumber.com/x/web?qs=0x2C35011004A4F0DC Linux Registered User #339825 at http://counter.li.org

Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
« previous php.general (#174747) next »