Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Red Hat This forum is for the discussion of Red Hat Linux.


  Search this Thread
Old 08-28-2009, 09:30 AM   #1
LQ Newbie
Registered: Aug 2008
Posts: 4

Rep: Reputation: 0
File contains replace command?

i want to replace one files total text contains with another files text contains from my fedora console.

for example:
Two files:-


i want replace to the total text contains of "resolv.conf" file with the "newresolv.conf" file's inside total text contains but "resolv.conf" file's name can't be change...only the inside text contains have to replace.

can any1 give me the command?

Last edited by vikibd007; 08-28-2009 at 09:51 AM.
Old 08-28-2009, 09:38 AM   #2
Senior Member
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Originally Posted by vikibd007 View Post
i want to replace one files total text contains with another files text contains from my fedora console.

can any1 give me the command?
could you please clarify the question? perhaps giving an example.
Old 08-28-2009, 02:42 PM   #3
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,568
Blog Entries: 30

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
cat /newresolv.conf > /etc/resolv.conf
Old 08-28-2009, 02:55 PM   #4
Senior Member
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Even easier:
cp newresolv.conf /etc/resolv.conf



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
Command Line File Replace MissingLink Linux - Newbie 3 02-06-2009 02:47 AM
Linux command to find and replace string within text file chips11 Linux - Newbie 5 11-24-2008 02:25 PM
command to replace a few entries on a file bostonthunder777 Linux - Server 4 10-18-2007 10:21 AM
Need command to search and replace text in file acascianelli AIX 12 04-11-2007 08:16 PM
help! Script or command needed to replace text in a file. farmerjoe Linux - Newbie 2 01-02-2005 03:07 PM

All times are GMT -5. The time now is 02:56 PM.

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