actually there's no need to use awk and even less need to try and suss the verbose rpm output.
$ rpm -qa -qf '%-40{NAME} %{SIZE}\n' | sort
almost all of the stuff rpm reports on is available as a querytag,
$ rpm --querytags
for the full list.
Stuart.
Angus Lees
<[EMAIL PROTECTED]> To: [EMAIL PROTECTED]
Sent by: cc:
[EMAIL PROTECTED] Subject: [SLUG] Re: ask summary of
installed programs
rg.au
12/03/2002 11:25
AM
Please respond to
Angus Lees
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
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug
