LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 09-02-2011, 08:39 AM   #1
zeusys
Member
 
Registered: Jun 2006
Posts: 31

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


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

Code:
enabled=1
I need to change this to :
Code:
enabled=0
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.

Code:
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 08:41 AM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 09-02-2011, 08:41 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,505

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

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

Rep: Reputation: Disabled
Quote:
Originally Posted by schneidz View Post
Code:
 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.
  


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


All times are GMT -5. The time now is 08:02 AM.

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