我想将下面的输入文件(abc)转换为输出文件(xyz),如下所述:
$more abc
"2005057400BPI","TS.1.BPI.20121112120000.000#S10S#.txt.xml"
"2005057408BPI","TS.1.BPI.20121112120000.000#S10S#.txt.xml"
"2005057488BPI","TS.1.BPI.20121112120000.000#S10S#.txt.xml"
$more xyz
"2005057400BPI",TS.1.BPI.20121112120000.000.txt
"2005057408BPI",TS.1.BPI.20121112120000.000.txt
"2005057488BPI",TS.1.BPI.20121112120000.000.txt
文件 abc 包含大约 35k 行。我正在转换为:
$perl -pi -e 's/"//g' abc
$cut -d'.' -f1-5 abc > xyz
$perl -pi -e 's/.....$/\.txt/g' xyz
$perl -pi -e 's/#//g' xyz
$perl -pi -e 's/^/"/g' xyz
$perl -pi -e 's/,/",/g' xyz
有没有其他方法可以用更少的命令更快地完成它。