<html>
<body>
<pre>
<tt>
#!/bin/sh
#
# ipsort
#
# A filter to sort a file like /etc/hosts by IP address.
#
ip='[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*'
sed "s/^\($ip\)/\1./" | sort -n -t. +0 -1 +1 -2 +2 -3 +3 -4 | sed "s/^\($ip\)./\1/"
</tt>
</pre>
<HR>
© 1998,
Boyd Roberts:
<A HREF="mailto:[email protected]">[email protected]</A>
</body>
</html>
|