On Sat, 22 Mar 2014, Julian Andres Klode wrote:
> On Sat, Mar 22, 2014 at 02:26:34PM +0100, Cristian Ionescu-Idbohrn wrote:
> > May I suggest a replacement for:
> >
> > list="$(${DPKG} -l | awk '/^ii[ ]+(linux|kfreebsd|gnumach)-image-[0-9]/ && 
> > $2 !~ /-dbg$/ { print $2 }' | sed -e 
> > 's#\(linux\|kfreebsd\|gnumach\)-image-##')"
> >
> > Either of these:
> >
> > list=$($DPKG -l | sed -rne 
> > '/^ii[[:blank:]]+((linux|kfreebsd|gnumach)-image-([0-9][^[:blank:]]+))[[:blank:]].*/{s//\3/;/-dbg$/d;p}')
> > list=$($DPKG -l | sed -ne 
> > '/^ii[[:blank:]]\+\(\(linux\|kfreebsd\|gnumach\)-image-\([0-9][^[:blank:]]\+\)\)[[:blank:]].*/{s//\3/;/-dbg$/d;p}')
> >
> > remove the need of forking `awk'.
>
> They're less readble than the version with sed and fork IMO.

Maybe.  Still, it's wasteful to fork both `awk' and `sed' for a simple
task like that.  Use just one of them.  I don't grok `awk', so I can't
help there.  But `awk' is a bigger hammer, AFAICT.


Cheers,

-- 
Cristian


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to