替换文件Foo->Bar
阿债
posted @ 2009年7月22日 00:38
in 未分类
, 1576 阅读
#!/bin/gawk -f
# 替换字符
# RUN:
# grep -irl "Foo" * |grep -i "Foo" |grep -v "awk" |xargs gawk -f rp.awk
BEGIN{
}
FNR==1{
outf = ARGV[ARGIND] #全路径
gsub("Foo", "Bar", outf)
#创建目录
woutf = outf
gsub("/","\\",woutf) #Windows下面的目录分隔符是(\)
system( sprintf("dirname %s |xargs mkdir",woutf) )
print( rep_str($0) "\n") ...