LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-06-2010, 12:30 PM   #1
secondchanti
LQ Newbie
 
Registered: Jul 2010
Posts: 23

Rep: Reputation: 15
Replacing a word with a number


Dear friends,

I WANT TO REPLACE A PARTICULAR WORD WITH A SPECIFIC NO.

EXAMPLE : I WANT TO REPLACE THE WORD IN A TEXT FILE say
yes/no with 999

( in my lengthy input file iam having around 4500 such words, yes/no. i want to repalce all the 4500 at a time)



pl guide me which command i can used.
Rao

Last edited by secondchanti; 08-06-2010 at 12:32 PM. Reason: spelling mistake
 
Old 08-06-2010, 12:47 PM   #2
rikijpn
Member
 
Registered: Jun 2007
Location: Japan
Distribution: Debian lenny, DSL, Solaris 10
Posts: 157

Rep: Reputation: 33
sed or a decent editor

sed or any decent editor (vi/emacs/ed, etc).
You did search the web first right...

Code:
sed -i 's/word_to_replace/for_this_word/g' somefile
the "-i" is for save changes.

And you don't need to put your question in capital letters...
 
  


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
[SOLVED] Replacing word occurance with an increasing number in a file using bash twoleggedtripod Linux - Newbie 13 08-08-2010 01:47 PM
the number of occurrences of the word in file hinetvenkat Linux - Software 1 02-20-2008 07:25 AM
replacing word for word Smokey Linux - Newbie 6 01-20-2006 03:58 PM
a command/script for replacing a word with another jaakkop Programming 14 12-04-2005 11:21 AM
sed help, replacing a letter with a word GridX Linux - Newbie 1 09-24-2003 11:21 AM


All times are GMT -5. The time now is 08:39 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