On Mon, Mar 11, 2002 at 12:44:36PM +1100, Andy Eager wrote:
> Just so happens I am working on a script to do a similar thing for the 
> LPIC course currently being undertaken at Granville TAFE.
> 
> rpm -qai | egrep "^Name|^Size" | sed "s/  */ /g" | awk 'BEGIN {FS=" "} \
>    $1 == "Name" && $2 == ":" { printf ("%s: %-40s", $1, $3) } \
>    $1 == "Size" && $2 == ":" { printf ("%s: %s\n", $1, $3) }' \
> | sort -k 4 -n  > packlist

rpm -qai | awk 'BEGIN {FS=" "} \
    $1 == "Name" && $2 == ":" { printf ("%s: %-40s", $1, $3) } \
    $1 == "Size" && $2 == ":" { printf ("%s: %s\n", $1, $3) }' \
  | sort -k 4 -n > packlist

no need to cleanup before passing to awk. awk is cleverer than you think.

-- 
 - Gus
-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to