I'm currently using two one-liners to 1. Extract information from a tab-delimited .txt file and then 2. Replace a set of strings within the newly created file:
perl -lane '$w = "w"; $l = length($F[9]); print "$w\t$F[2]\t$F[3]\t$l" if $F[1] =~ 99; $w = "c"; $l = length($F[9]); $p = $F[3]+$l; print "$w\t$F[2]\t$p\t$l" if $F[1] =~ 83; print "Head1\tHead2\tHead3\tHead4" if $.==1;'perl -ane '$F[1] =~ s/A/B/; $F[1] =~ s/C/D/; $F[1] =~ s/F/G/; say join "\t", @F'
Is there a way to combine these into a single line such that it performs this replacement before printing the new file?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |