On Thu, 2017-11-16 at 00:09 -0800, Russell Senior wrote: > Can anyone suggest a nice unix pipeline filter using lightweight > tools > (no python) to output an ipv6 address in reduced format. That is, > with > the extra zeros removed and colons condensed according the normal > ipv6 > rules. Bonus for an example that leaves timestamps unscathed. In my > case, the ipv6 address is inside square brackets. For example: > > ipv6 Thu Nov 16 00:05:34 PST 2017 > [2603:01c2:1800:a8c0:0000:0000:0000:0001] > foo bar baz > > should become: > > ipv6 Thu Nov 16 00:05:34 PST 2017 [2603:1c2:1800:a8c0::1] foo bar baz
How about cat logfile | sed -e 's/:0/:/g' -e 's/:0/:/g' -e 's/:0/:/g' -e 's/:0/:/g' -e 's/:::*/::/g' ? -- David Fleck <[email protected]> _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
