LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 11:30 AM   #1
secondchanti
LQ Newbie
 
Registered: Jul 2010
Posts: 24

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 11:32 AM. Reason: spelling mistake
 
Old 08-06-2010, 11:47 AM   #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



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 12:47 PM
the number of occurrences of the word in file hinetvenkat Linux - Software 1 02-20-2008 06:25 AM
replacing word for word Smokey Linux - Newbie 6 01-20-2006 02:58 PM
a command/script for replacing a word with another jaakkop Programming 14 12-04-2005 10:21 AM
sed help, replacing a letter with a word GridX Linux - Newbie 1 09-24-2003 10:21 AM

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

All times are GMT -5. The time now is 07:48 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
Open Source Consulting | Domain Registration