LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What is grep? (https://www.linuxquestions.org/questions/linux-newbie-8/what-is-grep-75396/)

Thaidog 07-24-2003 12:46 AM

What is grep?
 
I just got through with a job interveiw that has a lot of unix to it... one of the things that came up was the command grep...

They were doing something on te command line like: ... | grep....

Anyone?

ksgill 07-24-2003 12:52 AM

http://www.computerhope.com/unix/ugrep.htm#01

slakmagik 07-24-2003 12:56 AM

Y'know you can literally type 'whatis grep' into a prompt and get an answer? ;)

Code:

|--digiot@slackath Wed Jul 23 20:56:10
|--bash 2.05b ~ $ whatis grep
grep                (1)  - print lines matching a pattern


DrOzz 07-24-2003 12:57 AM

did you look at the man page?
man grep
so for example if i wanna use grep to search through my rpm database to see if i have xine installed i can use:
rpm -qa |grep xine
and this will only output from my whole rpm database any words that contain xine.
so my results are:
xine-0.9.20-fr1
xine-skins-1.5-fr1
xine-lib-1.0.0-fr0.beta9.1
if i would just type a simple rpm -qa i would get a huge list of everything and instead of searching through that list manually, i let grep do the work :D

DrOzz 07-24-2003 12:58 AM

man i'm slow hehe, there was no responses when i started typing :D

Thaidog 07-24-2003 01:02 AM

Quote:

Originally posted by digiot
Y'know you can literally type 'whatis grep' into a prompt and get an answer? ;)

Code:

|--digiot@slackath Wed Jul 23 20:56:10
|--bash 2.05b ~ $ whatis grep
grep                (1)  - print lines matching a pattern



I'm at work on my Windows box dogg.... no go for now :)

slakmagik 07-24-2003 01:07 AM

Well, install Cygwin! :D

ksgill 07-24-2003 01:09 AM

if you are on windows box read the second post

Thaidog 07-24-2003 03:04 AM

Quote:

Originally posted by Jatt_thugz
if you are on windows box read the second post
perfect! thx man


All times are GMT -5. The time now is 02:45 AM.