Created
October 2, 2018 18:36
-
-
Save avambro/5791d001865c69d637c8e8dcc72601e6 to your computer and use it in GitHub Desktop.
One way of running a find / replace in many files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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