文字列の一括置換

#!/bin/sh
# ------------------------
# replace scripst
# ------------------------
# Version : 1.0
# date    : 2008/01/21

export LANG=C
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH

LISTFILE="list.txt" 

WC=`wc -l $LISTFILE | awk '{print $1}'` 

i=1

while [ $i -le $WC ];
do
TARGET=`sed -n -e ${i}"p" $LISTFILE`
test -f $TARGET/index.html && echo $TARGET/index.html

# chenge
 mv $TARGET $TARGET.OLD
 cat $TARGET.OLD | sed "s/\/cgi\/rosen\/eki\/map\/mapMain.cgi/http\:\/\/mapmetwwwjp.tribeck.com\/cgi\/rosen\/eki\/map\/mapMain.cgi/g" >  $TARGET

# chenge permission
 chown nobody.nobody $TARGET/index.html
 chmod 666 $TARGET/index.html

i=$(($i+1))
done

# EOF

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS