Re: Boolean Grep?
Article: 7792 of alt.hackers From: guentbru@HERCULES.CS.UREGINA.CA (Bruce Guenter) Newsgroups: alt.hackers Subject: Re: Boolean Grep? Date: 10 May 1995 16:44:54 GMT Organization: University of Regina Lines: 47 Approved: guess who? Message-ID: firstname.lastname@example.org NNTP-Posting-Host: hercules.cs.uregina.ca Status: RO
In article <3okf3s$nnc@cnn.Princeton.EDU> <email@example.com> writes: >In article <firstname.lastname@example.org>, >Thomas Davis <email@example.com> wrote: >> #!/bin/csh >> set value = `grep $argv $argv`; >> if( $#value > 0 ) then >> echo "True" >> else >> echo "False" >> > >Ack!! That's disgusting. Didn't your parents teach you not to use >csh in public? Try /bin/sh instead: Amen! Or even better, /bin/bash (or /bin/ksh if all else fails) >grep pattern file1 file2 file3 > /dev/null && echo true I just don't get it. Why send output to /dev/null when *grep has an option to make it silent: grep -s pattern file1 file2 file3 && echo true ObHack: Unfortunately, I can't claim any credit for this, but a co-worker here has implemented a so-called data diode. He needed to track frames on an Ethernet transmitted between an IPX server and client, over two networks connected by a router. The trick is, he needs to record the data on both networks at the same time, using a single network sniffer. Hmmm... we just happen to have several devices sitting around known as local bridges -- they connect two LANs by selectively forwarding frames between the two. So, he connects one of these up to each of the LANs, feeding into the third LAN with the sniffer. These bridges are then configured to filter everything coming from the _other_ LAN. Voila. Data diode. Anyways, I thought it was neat. -- Bruce Guenter | #11-528 4th Ave N | The opinions expressed Bruce.Guenter@develcon.com | Saskatoon, SK, Canada | are not necessarily (306)652-8242 | S7K 2M7 | those of my employer. -- Bruce Guenter | #11-528 4th Ave N | The opinions expressed Bruce.Guenter@develcon.com | Saskatoon, SK, Canada | are not necessarily (306)652-8242 | S7K 2M7 | those of my employer.