LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   grep the contents of a file with another file (http://www.linuxquestions.org/questions/linux-newbie-8/grep-the-contents-of-a-file-with-another-file-834488/)

bluethundr 09-25-2010 05:59 PM

grep the contents of a file with another file
 
someone once told me that use can pass a file to grep and use that to search the contents of another file.

if that is the case I'm not entirely sure why the following isn't working for me.

Code:

[root@LCENT01:~]#grep -i id_rsa.pub .ssh/authorized_keys
[root@LCENT01:~]#cat id_rsa.pub >> .ssh/authorized_keys
[root@LCENT01:~]#grep -i id_rsa.pub .ssh/authorized_keys

thanks in advance!

fuubar2003 09-25-2010 06:04 PM

Code:

grep -f <filename> <filenameyouaresearching>
...is that what yer lookin for?

From 'grep --help':

-f, --file=FILE obtain PATTERN from FILE

bluethundr 09-26-2010 12:24 AM

done!!
 
Quote:

Originally Posted by fuubar2003 (Post 4108976)
Code:

grep -f <filename> <filenameyouaresearching>
...is that what yer lookin for?

From 'grep --help':

-f, --file=FILE obtain PATTERN from FILE

Yep that did it!!! thanks!!

grail 09-26-2010 01:24 AM

Please mark as SOLVED when you have a solution.


All times are GMT -5. The time now is 03:31 AM.