Alternate approach: tr '.' ' ' < address_list | xargs printf '%03d.%03d.%03d.%03d\n' \ | sort -u | sed -re 's/\b0+//g' ) < address_list Another way would be to multiply each address out into an int, sort, and re-format. -- Don Marti http://zgp.org/~dmarti/ dmarti at zgp.org