I'm trying to create a shell search and replace function to replace all occurrences of a string in a directory. The problem is how do I take the output of recursive grep and use it to find files to use for sed?
I've got the following pipeline grep -R protal ./ | sed 's/:.*//g' | sed 's/\/\//\//g'
. It produces this output:
./settings.py
./settings.py
./settings.py
./urls.py
./wsgi.py
./wsgi.py
I want to take this and split it into an array or something so I can do (pseudo-code):
for [[ $file in $file_list ]]; do
sed -i 's/$input_string/$replace_value/g' $file
done
How would I do that?