[nflug] Unix Command / Bash Question...
DANIEL MAGNUSZEWSKI
dmagnuszewski at mandtbank.com
Fri Jan 27 10:25:31 EST 2006
All,
I wrote a Perl script to parse a file for ip addresses and hostnames,
and to print out in the format of:
$ip,$hostname
There are some duplicates in the list, so I was just using some Unix
commands and pipes to rid them from the output. While doing this, I ran
into something interesting.
If I do:
user at server:/opt/cwscripts# ./dcraudit.pl | uniq | grep -i '10.x.x.x'
I get the output of:
10.x.x.x,router1
10.x.x.x,router1
If I switch the 'uniq' and 'grep' and run:
user at server:/opt/cwscripts# ./dcraudit.pl | grep -i '10.x.x.x' | uniq
I get the output of:
10.x.x.x,router1
What is the technical reason for this? I assumed that it would work
either way.
Thanks.
-Dan
_______________________________________________
nflug mailing list
nflug at nflug.org
http://www.nflug.org/mailman/listinfo/nflug
More information about the nflug
mailing list