- 論壇徽章:
- 0
|
原帖由 nully 于 2008-10-25 15:13 發(fā)表 ![]()
先對(duì)樓上幾位表示感謝
對(duì)于seelnd的touch方法我也有用過(guò),但由于是在cygwin上跑,大量的時(shí)間耗在system(touch)上了,不合算
zhangshebao的把非法字符替換掉也不太可行,因?yàn)?1有中文情況
...
出錯(cuò)情況 ...
這個(gè)可以,在cygwin上測(cè)試過(guò)了:
echo "a b
aaa/bb ccc
工人 bbb
aaaa#aa/ 333"|awk '
fname[$1]==""{
if(0==system("echo "$2">>"$1".txt"))fname[$1]=$1".txt";
else {
print "ERROR:echo "$2">>"$1".txt">>"出錯(cuò)日記.log";
last1=$0;gsub(/[^a-zA-Z_\-0-9\200-\377]/,"#",last1)
if(0==system("echo "$2">>"last1"改名.txt")){
fname[$1]=last1"改名.txt";
print $1".txt 改名為:"last1"改名.txt">>"出錯(cuò)日記.log";
} else{
print "ERROR:echo "$2">>"last1"改名.txt">>"出錯(cuò)日記.log";
}
}
}
fname[$1]!=""{ print $2 >> fname[$1] }
' |
|