On Thu, Nov 16, 2017 at 4:30 AM, David Fleck <[email protected]> wrote:
> 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'
> ?

Nice, that's a notch better than I came up with.  But, sadly, it still
munges the timestamps with leading zeros in minutes and seconds.
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to