solaris_批次替換指定字串_find_xargs_grep

wangzhensheng發表於2008-07-22

==========================
#!/bin/sh
apps_dir='/tmp/ddd/fj'

cd ${apps_dir}/
while read strs
do
echo ${strs}
find ./ -type f | xargs perl -pi -e "s|href="${strs}|href="/|g"
find ./ -type f | xargs perl -pi -e "s|href=" ${strs}|href="/|g"
find ./ -type f | xargs perl -pi -e "s|src="${strs}|src="/|g"
done < /tmp/ddd/string_file

[@more@]

==========================
#!/bin/sh
apps_dir='/tmp/ddd/fj'

cd ${apps_dir}/
while read strs
do
echo ${strs}
find ./ -type f | xargs perl -pi -e "s|href="${strs}|href="/|g"
find ./ -type f | xargs perl -pi -e "s|href=" ${strs}|href="/|g"
find ./ -type f | xargs perl -pi -e "s|src="${strs}|src="/|g"
done < /tmp/ddd/string_file

===============================
#!/bin/sh
apps_dir='/weblogic/weblogic/myserver'

cd ${apps_dir}
while read domain
do
while read APPS
do
while read file_type
do
find ./${APPS} -type f | grep -v 'logs' | grep -vi 'jpg' | grep "${file_type}$" | xargs grep -l "${domain}" |
cpio -o>/tmp/ddd/${domain}_${APPS}_${file_type}.cpio
done < ./ddd/file_types
done < ./ddd/apps
done<.>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8806316/viewspace-1007659/,如需轉載,請註明出處,否則將追究法律責任。

相關文章