scripting fun

Derek Broughton news at pointerstop.ca
Thu Jun 5 18:58:42 UTC 2008


Bart Silverstrim wrote:

> sort ~/temp/tmp.txt > ~/temp/tmp2.txt
> uniq ~/temp/tmp2.txt > ~/temp/slurps.txt

sort -u ~/temp/tmp.txt > ~/temp/slurps.txt
 
which would simplify this, at least:
 
> iptables -L INPUT -v -n |awk '{print$8}' |grep '[0-9]' 
>   >  ~/temp/blocked.txt 
> join -v2 < (sort <~/temp/blocked.txt | uniq ) < (sort <~/temp/slurps.txt
> | uniq ) > ~/temp/newaddresses.txt

and what's the input redirector to sort doing?  (I'm no shell script expert)

How about:
 iptables -L INPUT -v -n |awk '{print$8}' |grep '[0-9]' |
   sort -u > ~/temp/blocked.txt
 join -v2 < ~/temp/blocked.txt < ~/temp/slurps.txt > ~/temp/newaddresses.txt

(slurps.txt is already sorted and unique)
-- 
derek





More information about the ubuntu-users mailing list