~ overflow ~

Tag: replace in files

Search in files and replace by bash

by z3n on Oct.26, 2009, under Coding, Linux Happyness, Tips & Hints

Problem:

How to change a string on several files by bash without opening one by one.

Solution:

for i in $(find . -type f); do sed ’s/find/replace/g’ $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done

Yes, it’s just a copy paste from the source, i don’t have time to explain each command.

Source:

CodeSnippets

Leave a Comment :, , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!