How Do I Find and Replace Text in Multiple Files in Linux?
Contents

How do you find and replace a string in multiple files in Linux?

sed

  1. i — replace in file. Remove it for a dry run mode;
  2. s/search/replace/g — this is the substitution command. The s stands for substitute (i.e. replace), the g instructs the command to replace all occurrences.

How do I find and replace text in multiple files?

Remove all the files you don’t want to edit by selecting them and pressing DEL, then right-click the remaining files and choose Open all. Now go to Search > Replace or press CTRL+H, which will launch the Replace menu. Here you’ll find an option to Replace All in All Opened Documents.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest