2017-08-17
改程式用到
find ./ -type f -name \*.php |xargs grep 姓氏
還可用 -r
grep -r 姓氏 *
更改的記錄一下 :
grep -r 貴姓 > /tmp/a
catalog/language/zh-tw/mail/register.php:$_['text_firstname']
catalog/language/zh-tw/mail/affiliate.php
catalog/language/zh-tw/account/register.php
catalog/language/zh-tw/account/register.php
catalog/language/zh-tw/account/address.php
catalog/language/zh-tw/account/address.php
catalog/language/zh-tw/account/edit.php
catalog/language/zh-tw/account/edit.php
catalog/language/zh-tw/account/return.php
catalog/language/zh-tw/account/return.php
catalog/language/zh-tw/affiliate/register.php
catalog/language/zh-tw/affiliate/register.php
catalog/language/zh-tw/checkout/checkout.php
catalog/language/zh-tw/checkout/checkout.php
catalog/language/zh-tw/api/payment.php
catalog/language/zh-tw/api/customer.php
catalog/language/zh-tw/api/shipping.php
admin/language/zh-tw/sale/order.php
admin/language/zh-tw/sale/return.php
admin/language/zh-tw/sale/return.php
admin/language/zh-tw/user/user.php
admin/language/zh-tw/user/user.php
cat /tmp/a | awk '{FS=":";print "mv "$1" "$1".old"}' > /tmp/b
sh /tmp/b
cat /tmp/a | awk '{print "sed '"'"'s/貴姓/姓名/g'"'"' "$1".old > "$1}' > /tmp/b
sh /tmp/b
cat /tmp/a | awk '{print "rm -rf "$1".old"}' > /tmp/b
sh /tmp/b