Does anyone have a Linux shell script to do the following:
Walk through all sub-directories below the current one and replace the text in files of a specified extension with the given text. The only kicker is, I want to replace a block of text from each file that is probably about 10 lines long, so I don't know if I can just use something like this:
Code:
#! /bin/sh
# filename: replaceall
find . -type f -name '*.txt' -print | while read i
do
sed 's|foo|bar|g' $i > $i.tmp && mv $i.tmp $i
done
Thanks