Sam Trenholme's webpage
This article was posted to the Usenet group alt.hackers in 1995; any technical information is probably outdated.

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: 3oqqi6$f5e@sue.cc.uregina.ca
NNTP-Posting-Host: hercules.cs.uregina.ca
Status: RO

In article <3okf3s$nnc@cnn.Princeton.EDU> <dawagner@princeton.edu>
writes:
>In article <3oisj9$vp1@hopi.gate.net>,
>Thomas Davis <tdavis@news.gate.net> wrote:
>> #!/bin/csh
>> set value = `grep $argv[1] $argv[2]`;
>> 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.



Parent Parent

Child

Back to index