Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-02-2011, 09:39 AM   #1
Registered: Jun 2006
Posts: 31

Rep: Reputation: 0
Question How to edit a specific parameter in many files simultaneously

I need to change following parameter in multiples files.It's hard to edit them one by one with vi.

I need to change this to :
I suppose that I have to use sed command to achieve this goal.But I don't know how I can save the output to separated files as they were.

sed 's/enabled=1/enabled=0/g' *
I use this,but output doesn't go to a separated file.Also I know about redirections.
Please guide me
thank you

Last edited by zeusys; 09-02-2011 at 09:41 AM.
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 09-02-2011, 09:41 AM   #2
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,563

Rep: Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900
man sed will give you your answer.
1 members found this post helpful.
Old 09-02-2011, 11:21 AM   #3
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,161

Rep: Reputation: 889Reputation: 889Reputation: 889Reputation: 889Reputation: 889Reputation: 889Reputation: 889
i would use a for loop to go thru each file and edit everything you want in an automated way:
for item in *
 sed 's/enabled=1/enabled=0/g' $item > $item.sed
 #mv $item.sed $item
2 members found this post helpful.
Old 09-02-2011, 11:59 AM   #4
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Originally Posted by schneidz View Post
 sed 's/enabled=1/enabled=0/g' $item > $item.sed
You could of course use the -i option to edit in place.
2 members found this post helpful.


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
logging to two log files simultaneously? dbrazeau Linux - Software 3 10-29-2010 11:53 AM
copy files from one source to multiple destination simultaneously mdfakkeer Programming 7 08-06-2010 08:05 AM
dd 2 output files simultaneously, is it possible? kav Linux - Software 1 07-28-2007 02:39 PM
Konqueror - Renaming multiple files simultaneously RodWC Linux - General 9 11-29-2006 10:20 AM
playing 2 files simultaneously ciopi Linux - Software 4 12-04-2005 01:43 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:07 AM.

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