Skip to content

Instantly share code, notes, and snippets.

@avambro
Created October 2, 2018 18:36
Show Gist options
  • Save avambro/5791d001865c69d637c8e8dcc72601e6 to your computer and use it in GitHub Desktop.
Save avambro/5791d001865c69d637c8e8dcc72601e6 to your computer and use it in GitHub Desktop.
One way of running a find / replace in many files
#File: file.list.txt
#/path/to/file/1.txt
#/path/to/file/2.txt
#/path/to/file/3.txt
#! /user/bin/env bash
while IFS="" read -r p || [ -n "$p" ]
do
echo "Replacing content in file $p"
sed -i -e 's/find_me/replace_with_this/g' $p
done < file_list.txt
@avambro
Copy link
Author

avambro commented Oct 2, 2018

to find & replace static_1.2.3/app.js -> static/app.js

sed -i -e 's@static_1.2.3/app.js@static/app.js@g' /path/to/file.ext

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment