[plug] re: awk

Derek Fountain derekfountain at yahoo.co.uk
Sun Jul 20 23:06:27 WST 2003


> I must admit that I've been writing a Linux dictionary of late and have
> come across this problem. Anyway, rpm -qa --info and then pipe it into the
> program below. Please note that this is very roar and that I also have a
> few other scripts/programs that are designed to transform it into something
> much neater (more suitable for the dictionary). Also, this could be an
> old/er version of the program. Could do with some nipping up.
>
> Binh.
>
> >Start Program
<snip!>

It being a Sunday night, and me not having a lot to do, I decided to have a 
look into that Java program you posted. I don't know much about Java, and 
couldn't get your program to run (I spent some time installing the 'gjc' 
stuff, and only got loads of exceptions when I ran your code). Probably my 
environment - as I say, I don't really know what I'm doing with Java. 
However, having read the code, I think I worked out what it does. Those 100 
odd lines of Java do this:

perl -ne '/^Name\s*:\s(\w+)/ and print $1,"\n"'

i.e. they print the names of the installed RPM packages without the version 
numbers, as the OP requested:

>rpm -qa --info | perl -ne '/^Name\s*:\s(\w+)/ and print $1,"\n"'
aaa_version
OpenOffice_org
filesystem
release
sash
saxident
ispell
...

I can't help thinking that Java probably wasn't the best tool for this job... 
:o)

-- 
> eatapple
core dump



More information about the plug mailing list