#!/bin/bash
DIR="$1"
SEARCH="$2"
for f in $(find $DIR -name "$SEARCH" -type f); do
cp $f $f.bak
# sed 's/flush_work_sync/flush_work/g' $f.bak > $f
sed 's/PIERWOTNY_TEXT/ZAMIENNIK,/g' $f.bak > $f
done
DIR="$1"
SEARCH="$2"
for f in $(find $DIR -name "$SEARCH" -type f); do
cp $f $f.bak
# sed 's/flush_work_sync/flush_work/g' $f.bak > $f
sed 's/PIERWOTNY_TEXT/ZAMIENNIK,/g' $f.bak > $f
done
Wywołanie
./replace.sh /opt/linux/ *.c
lub
./replace.sh /opt/linux/ *.txt