[nycbug-talk] useless use of awk? how to fix?

Jesse Callaway bonsaime at gmail.com
Thu May 3 20:50:13 EDT 2012

On Thu, May 3, 2012 at 8:07 PM, Jesse Callaway <bonsaime at gmail.com> wrote:
> This is OBVIOUSLY an rhel/vmware related example, but check it out...
> rpm -qa | awk 'BEGIN {x=0} /^vmware-tools/ {x++; pkgs[x] = $1} END{
> print "yum -y remove \\"; for (y = 1; y < x; y++) print pkgs[y] " \\";
> print ";"}' | awk -F '-[[:digit:]]' '{print $1}'
> Yeah, it could be wrapped in an awk system() call instead of finally
> piping to the shell, but that would be another construct completely.
> Although suggestions for solving that are also welcome. Would love to
> see how this could be done more succinctly YET retaining the somewhat
> readable instructions.
> This was probably best asked a few months ago when the awk specific
> talk was fresh in our minds...
> --
> -jesse

Oh lord... yum really does allow for wildcards. Let's please ignore
the yumminess of this.


More information about the talk mailing list