LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   need help .... find & grep (https://www.linuxquestions.org/questions/linux-newbie-8/need-help-find-and-grep-779162/)

mgra99 12-31-2009 07:41 PM

need help .... find & grep
 
hi there,
i want to know
how can i find in my system about a such word like 'hello' in a such file and then if we found it remove this word from that file ?

bartonski 12-31-2009 09:05 PM

Quote:

Originally Posted by mgra99 (Post 3810428)
hi there,
i want to know
how can i find in my system about a such word like 'hello' in a such file and then if we found it remove this word from that file ?

Ok, let's say that you're looking to delete the word 'hello' from all files in the directory /home/me/txt:

Code:

find /home/me/txt | xargs sed 's/hello//g'

pixellany 12-31-2009 09:16 PM

In one directory:
Code:

sed -i 's/hello//g' *
To search by content in the entire system is a bit messy---is that really what you need to do?

"find" is not good for searching by content......


All times are GMT -5. The time now is 12:28 PM.