The way I'd do it is put the values in an array, process the array and print it with either $, or $" set to "\t".
BEGIN { $,="\t"; print "Head1".."Head4"; } @v = ("w", $F[2], $F[3], length($F[9])); $v[0] = "c" and $v[2]++ if $F[1] =~ /83/; v[1] =~ tr/ACF/BDG/; print @v if $F[1] =~ /99|83/;
Untested, since I didn't have input data :).
"Head1".."Head4" is a little bit of perl magic to print your headers. tr will replace every occurrence of the letters, not just the first like you did, but you get the idea.
Edit: removed useless slice on first definition of @v.
Edit: replaced all the $v{X} by $v[X]
In reply to Re: Performing search and replace on an output file prior to printing
by Eily
in thread Performing search and replace on an output file prior to printing
by TJCooper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |