#! /bin/sh
# Please back up your files before runing this script.
# Use sed to replace 'foo' with 'bar' for all .txt files in current folder.
for file in *.txt
do
  sed 's|foo|bar|g' $file > $file.tmp && mv $file.tmp $file
done

