Thanks to the info on this site, I had the one-liner that does the trick:
Code: Select all
find . -name '*.txt' |xargs perl -pi -e 's/find/replace/g'
Code: Select all
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
Code: Select all
#!/bin/bash
#
# replaces a certain pattern in multiple files.
# @author: ^Rooker
# @date: Dec 15th, 2006
FILEMASK="*.m3u";
HOSTNAME="www.das-werkstatt.com";
case "$1" in
GO)
find . -name "$FILEMASK" | xargs perl -pi -e "s/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/$HOSTNAME/g"
;;
LIST)
find . -name "$FILEMASK"
;;
*)
echo;
echo "Replaces any IP within $FILEMASK files by a given hostname ($HOSTNAME)"
echo "SYNTAX: $0 (GO|LIST)";
echo;
;;
esac