PDA

View Full Version : Need Explanation of a Command-Line



TheEngineer
28th September 2005, 11:31 AM
Hi.

This is mainly directed towards those who are experts in shell scripts.

I basically need the following command line explained in stages:

rpm -qa | grep ^vim | awk '{print "rpm -ql " $1 }' | /bin/sh | less

I understand the function of the following individual commands:

rpm -qa rpm -ql grep ^vim less /bin/sh and the pipe operator, but don't understand the awk command.

I know that rpm -qa | grep ^vim will list any vim packages, if installed, but don't understand the rest of the command line.

I would appreciate any help.

Thanks.

Jules

jgraber
28th September 2005, 12:03 PM
Hi,

I think it make this (but maybe i am wrong ;) )

rpm -qa | grep ^vim give you a list of all vim packages (Line start with vim) and a lot of description.

The awk-command take the first word ($1) and put the string "rpm -ql" in front of it.

It makes from "vim_package for this purpose" an "rpm -ql vim_package".

Then it execute this command and show the output in the less program.

markkuk
28th September 2005, 02:27 PM
Here's a lot simpler command line for doing the same thing:

rpm -qa 'vim*' | xargs rpm -ql | less