LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Use sed to edit string in multiple files not contained in current directory (https://www.linuxquestions.org/questions/linux-newbie-8/use-sed-to-edit-string-in-multiple-files-not-contained-in-current-directory-873525/)

DylanB 04-07-2011 02:15 AM

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

DylanB 04-07-2011 02:27 AM

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


All times are GMT -5. The time now is 09:23 PM.