LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What does rpm -qa |grep th* (as compared to rpm -qa |grep th) display? (https://www.linuxquestions.org/questions/linux-newbie-8/what-does-rpm-qa-%7Cgrep-th%2A-as-compared-to-rpm-qa-%7Cgrep-th-display-159264/)

davidas 03-18-2004 12:29 AM

What does rpm -qa |grep th* (as compared to rpm -qa |grep th) display?
 
rpm -qa |grep th displays packages with "th" in their name.

What do rpm -qa |grep th* and rpm -qa |grep *th display? I don't quite understand the output. rpm -qa |grep th* seems to display any package with "t" in the name?!

Some concept teaching required here :)

Thanks !

Demonbane 03-18-2004 12:43 AM

Grep takes regular expressions, so "grep th*" is actually equivalent to "any line that has the letter 't' and any number of 'h'(including 0)".
If you want to grep for packages that start with "th", try
Code:

rpm -qa | grep ^th

davidas 03-18-2004 01:35 AM

Could you elaborate on "regular expressions"? Does "grep th3" refers to "any line that has the letter 't' and 3 instances of 'h'"?

Thanks !

Quote:

Originally posted by Demonbane
Grep takes regular expressions, so "grep th*" is actually equivalent to "any line that has the letter 't' and any number of 'h'(including 0)".
If you want to grep for packages that start with "th", try
Code:

rpm -qa | grep ^th



All times are GMT -5. The time now is 07:58 AM.