[PLUG] Fun sed challenge!

Russell Senior russell at personaltelco.net
Fri Nov 17 02:31:20 UTC 2017


On Thu, Nov 16, 2017 at 5:40 PM, David Fleck <david.fleck at mchsi.com> wrote:
> On Thu, 2017-11-16 at 04:48 -0800, Russell Senior wrote:
>> 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.
>
> Oops, didn't notice the timestamp.  How about:
> cat testline | sed -e 's/ \(..\):\(..\):\(..\) /x\1x\2x\3x/' -e
> 's/:0/:/g' -e 's/:0/:/g' -e 's/:0/:/g' -e 's/:0/:/g' -e 's/:::*/::/g'
> -e 's/x\(..\)x\(..\)x\(..\)x/ \1:\2:\3 /'

Seems to work!  A winner!  Thanks!



More information about the PLUG mailing list