Hi,
I am new to Linux commands.
I want to know about Linux Grep Command. My friend told me that its very helpful to find files with similar extension, Is it true?
Please help me with Grep & find command in Linux.
Thanks in Advance.
Hi,
I am new to Linux commands.
I want to know about Linux Grep Command. My friend told me that its very helpful to find files with similar extension, Is it true?
Please help me with Grep & find command in Linux.
Thanks in Advance.
Grep command searches the given file for lines containing a match to the given strings or words.
See grep command prints the matching lines. Use grep to search for lines of text that match one or many regular expressions, and outputs only the matching lines.
syntax:
Search /etc/passwd for boo user:Code:grep 'word' filename grep 'string1 string2' filename cat otherfile | grep 'something' command | grep 'something'
Code:$ grep boo /etc/passwd
Thanks for the quick reply but My actual problem is that I can not find out the exact difference between the "grep" & "find" command.
There is some similarity between the commands, that is true. But 'find' is a tool to search the filesystem, while 'grep' is a tool to search for regular expressions in bigger streams of text.
find searches for files and directories that match a user specified set of criteria. grep searches the contents of files for patterns that match those provided by the user.
Read the man pages for find and grep for details.
Bookmarks