[ILUG] Sed/tex processing Question
Kingsley G. Morse Jr.
change at nas.com
Tue Mar 10 23:22:13 GMT 2009
Hi Rory,
You might like to visit the #sed channel on
freenode's IRC network.
I also find myself wondering if, instead of
retaining certain parts of the line via
back-references, a better strategy might be to
delete the rest, possibly by employing sed
multiple times in a pipe.
For example, replace
echo "abc" | sed 's/.\(.\)./\1/'
with
echo "abc" | sed 's/a//' | sed 's/c//'
Thanks,
Kingsley
On 03/09/09 17:53, rory.winston at gmail.com wrote:
> Hi All
>
> I have a sed question: currently I am using sed to preprocess some garbage
> collection log files produced by Java.
> There are 10 pieces on information on every line that I would like to
> extract. I have just knocked up a large and ugly sed command to do this:
>
> # Typical line
> # 7.181: [GC 7.181: [ParNew: 6193K->101K(6528K), 0.0031050 secs]
> 8470K->2692K(64832K), 0.0031680 secs]
>
> $ sed -n "/GC/{s/^\([0-9]\+\.[0-9]\+\): \[GC \([0-9]\+\.[0-9]\+\): \[ParNew
> : \([0-9]\+\)K->\([0-9]\+\)K(\([0-9]\+\)K), \([0-9]\+\.[0-9]\+\) secs\]
> \([0-9]\+\)K->\([0-9]\+\)K(
> \([0-9]\+\)K), \([0-9]\+\.[0-9]\+\) secs\]/\1,\2,\3,\4,\5,\6,\7,\8,\9/gp}"
> logfile
>
> This has a fatal flaw, in that I have exhausted the maximum number of
> backreferences available. Does anyone know a better way to do this?
>
> Thanks
> Rory
> --
> Irish Linux Users' Group mailing list
> About this list : http://mail.linux.ie/mailman/listinfo/ilug
> Who we are : http://www.linux.ie/
> Where we are : http://www.linux.ie/map/
More information about the ILUG
mailing list