LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 04-07-2011, 03:15 AM   #1
DylanB
LQ Newbie
 
Registered: Sep 2009
Posts: 4

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


Hello,

I have the following problem:

CASE_FOLDER
----------->0_FOLDER
-------------------->ForceX ForceY ForceZ
----------->1_FOLDER
----------->2_FOLDER
---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?

Cheers,
Dylan
 
Old 04-07-2011, 03:27 AM   #2
DylanB
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.

Cheers,
Dylan
 
  


Reply

Tags
sed


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


All times are GMT -5. The time now is 08:36 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration