LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-31-2009, 08:41 PM   #1
mgra99
LQ Newbie
 
Registered: Dec 2009
Posts: 4

Rep: Reputation: 0
Question 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 ?
 
Old 12-31-2009, 10:05 PM   #2
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 47
Quote:
Originally Posted by mgra99 View Post
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'
 
Old 12-31-2009, 10:16 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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......
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help :() How to find an address using "grep" & regEx's. linuxmaveric Programming 8 04-28-2010 01:31 AM
Find/grep/wc command to find matching files, print filename and word count dbasch Linux - Newbie 10 09-14-2009 06:55 PM
find grep foampile Linux - Newbie 5 04-24-2009 07:14 PM
Can I use GREP to find & replace text? jim.thornton Linux - Newbie 3 07-18-2008 07:36 PM
help me find grep-2.5.1 shanenin Linux - Software 1 01-23-2004 10:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration