Used grep command before ?
grep is a very good command that allows you to grep text :)
It allows you to search the contents of a file/group of files for a string (regular expression)
of course it is great, but the output may be somewhat confusing !!!!
so, try this:
alias grep='grep --color=always'
then try to use grep, you will see the output contains the string you search for is highlighted.
try to put this command in your .bashrc file in order not to re-alias it each time, like that :
echo "alias grep='grep --color=always'" >> ~/.bashrc
Showing posts with label grep. Show all posts
Showing posts with label grep. Show all posts
Tuesday, August 25, 2009
Sunday, August 16, 2009
How to search for a string inside multiple text files
find starting_folder -name "*" | grep -i file_name | xargs grep -i search_string
for example:
"find . -name "*" | grep -i hobba | xargs grep -i tito"
searches for the string "tito" inside all files whose name contains the word "hobba" inside the current folder.
Note that the "-i" parameter for the "grep" command makes the search case insensitive.
for example:
"find . -name "*" | grep -i hobba | xargs grep -i tito"
searches for the string "tito" inside all files whose name contains the word "hobba" inside the current folder.
Note that the "-i" parameter for the "grep" command makes the search case insensitive.
Subscribe to:
Posts (Atom)