sed woes

Paul Seamons paul at seamons.com
Thu Dec 14 11:58:51 MST 2006


The other replies will work well - but what if you want it to stay in order?

Then here is a short perl line.

[paul at www1 lib]$ echo "foo
foo
bar
foo
bar
bing" | perl -ne 'print if ! $used{$_}++'
foo
bar
bing

And if you only want to deal with lines with ips - then you could do

cat /etc/hosts.deny | perl -ne 'print if ! /^ALL:(\S+)/ || ! $used{$1}++'

Paul



More information about the PLUG mailing list