Re: Automatic installs
On Sunday, November 17, 2013 04:20:25 PM Bob Proulx wrote:
> P.S. Yes I know mixing awk and grep is silly since awk can do it all.
>
> dpkg --purge $(dpkg -l | grep ^rc | awk '{print$2}' | grep ^lib)
>
> I normally would have said this and done it all with awk.
>
> dpkg --purge $(dpkg -l | awk '/^rc/&&$2~/^lib/{print$2}')
>
> But I didn't think that was a clear of intent as the former in an
> email. So I went with the more obvious logic even though it mixed
> commands in a silly way.
If the command was intended to be run once every second, the latter might be
preferred. But since absolute efficiency isn't required, the former is clearer
and is far more easily understood by non-experts.
Actually, if efficiency was important, the --purge option would accept a
regex. Or there'd be a --purgex option.
Enough pedantry for now. :)
Reply to: