ƯÁ¤ ¹®ÀÚ¿ ¹Ù²Ù´Â ½©½ºÅ©¸³Æ® |
±Û ¾´ ÀÌ |
linux |
³¯ Â¥ |
2003³â 03¿ù 11ÀÏ 10½Ã 49ºÐ 48ÃÊ |
º» ¹® |
#!/bin/sh
if test $# -eq 3
then
echo ""
else
echo "Usage : ./file_change.sh [path] [search string] [alternate string]"
exit 0
fi
grep_result=`grep -r -l $2 $1 | awk -F: '{print $1}'`
search_string=$2
alternate_string=$3
for file in $grep_result
do
file_new=$file'.tmp'
sed 's/'$search_string'/'$alternate_string'/g' $file > $file_new
mv $file_new $file
echo $file' changed.'
done
|
|
|
|