Antes de usar este script, instale o inotify-tools ( sudo apt-get install inotify-tools
).
#!/bin/bash
FILE=/path/to/monitored/file
DSTFILE=/path/to/destination/file
SEARCH="Text you want to replace"
REPLACE="Text that will replace the one in SEARCH"
while inotifywait -e modify $FILE; do
sed "s/$SEARCH/$REPLACE/g" $FILE > $DSTFILE
done