Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 04-07-2011, 03:15 AM   #1
LQ Newbie
Registered: Sep 2009
Posts: 4

Rep: Reputation: 0
Use sed to edit string in multiple files not contained in current directory


I have the following problem:

-------------------->ForceX ForceY ForceZ
---more folders---

The 3 Force* files contained in all folders (1,2,3..._FOLDER) have the following string skin:012 which I would like to change to skin_abc.
My plan was to use sed to edit the files in the following way:
sed 's/skin:.../skin_abc/g' $(find . -name Force*)
This seems to do what I want except that the output prints to the terminal. How can the substitution be incorporated in the files themselves rather simply the output to the screen?

Old 04-07-2011, 03:27 AM   #2
LQ Newbie
Registered: Sep 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Fixed it!

Of course 5mins after I post a question I figure out what I was missing.
"-i" made the changes occur in the files themselves, i.e.

sed -i 's/skin:.../skin_abc/g' $(find . -name Force*)

Hopefully this is useful for someone else.




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
move all files in current directory into a subdirectory in the current directory jakykong Linux - Newbie 8 07-17-2013 12:46 AM
[SOLVED] How to find a string in files under the current directory? thomas2004ch Linux - Newbie 4 10-05-2010 07:41 AM
Directory /var/lock/subsys needs to be created in Current EDIT: No it doesn't piratesmack Slackware 3 07-12-2010 11:45 AM
ash test: is string A contained in string B chochem Programming 6 09-24-2008 07:59 AM
edit path environment variable to include current working directory alb1954 Linux - Newbie 8 07-12-2004 12:26 AM > Forums > Linux Forums > Linux - Newbie

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