[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#742318: apt: version 'amd64' has bad syntax



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


Reply to: