I want to convert below input file(abc) to output file(xyz) as mentioned below:
$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
File abc contains aorund 35k lines. I am doing conversion as:
$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
Is there any other way to do it faster with less number of commands.
Using Perl:
Add option -i to update the file in place.