Formatting columns in file

I have a script that creates a file with three column output. The columns look like this:

Policy Name Name Volume
VLS-EDWARDS-ARCHIVED_FILE-WINDOWS 10 12
XLZ-BASE-CYGWIN-ARCHIVED-FILE-LINUX 2 21
ZLX-GOLD-FILES-JAPANFILERS1-LINUX 20 27
ZLX-GOLD-FILES-JAPANFILERS2-LINUX13 29
ZLX-GOLD-FILES-JAPANFILERS3-LINUX 20 20
ZLX-GOLD-FILES-JAPANFILERS4-LINUX19 19

I have run the following command which puts them in order:

vols.txt |awk '{ printf "%-50s%-50s %s\n", $1, $2,$3 }'

However, then I tried to subtract column 3 from column2 and the format now is abysmal:

cat vols.txt |gawk 'NF > 1 { print $1 "\t" ($3 - $2) } END { printf "%-50s%-50s %s\n", $1, $2,$3 }'

Is the END statement wrong? The columns are now longer straight and in order; they have numbers zig zagging in and out such as:

[VLS-EDWARDS-ARCHIVED_FILE-WINDOWS 10                12  2
XLZ-BASE-CYGWIN-ARCHIVED-FILE-LINUX 2 21     19
ZLX-GOLD-FILES-JAPANFILERS1-LINUX 20            27   7

Anybody know how to perform the subtraction and format this in one line so it looks like a readable file?

1) your file's lines 5 and 7 have just two fields.
2) the END pattern action is performed once at the end of the input stream. So it will print out the last line after formatting (not all awk versions have the last line's values persisting).
3) The NF>1 pattern will always be true and thus is redundant (at least for your sample).
4) awk will work on files supplied as parameters; no cat ting and piping necessary.

Taking the example you provide :

$ cat tst
Policy Name Name Volume
VLS-EDWARDS-ARCHIVED_FILE-WINDOWS 10 12
XLZ-BASE-CYGWIN-ARCHIVED-FILE-LINUX 2 21
ZLX-GOLD-FILES-JAPANFILERS1-LINUX 20 27
ZLX-GOLD-FILES-JAPANFILERS2-LINUX13 29
ZLX-GOLD-FILES-JAPANFILERS3-LINUX 20 20
ZLX-GOLD-FILES-JAPANFILERS4-LINUX19 19
$ sed 's/LINUX */LINUX /' tst |  awk '{print $0,(NR>1?$NF-$(NF-1):z)}'
Policy Name Name Volume 
VLS-EDWARDS-ARCHIVED_FILE-WINDOWS 10 12 2
XLZ-BASE-CYGWIN-ARCHIVED-FILE-LINUX 2 21 19
ZLX-GOLD-FILES-JAPANFILERS1-LINUX 20 27 7
ZLX-GOLD-FILES-JAPANFILERS2-LINUX 13 29 16
ZLX-GOLD-FILES-JAPANFILERS3-LINUX 20 20 0
ZLX-GOLD-FILES-JAPANFILERS4-LINUX 19 19 0
$

The first sed statement is used in order to reformat correctly your output especially regarding
LINUX13 and LINUX19 which - i suppose - should be LINUX 13 and LINUX 19 instead (the number must be separated from the string)

Then awk print the line adding the substraction of last-1 field from last field.
The NR>1 is used to skip the header line

I am not sure what the ? is in awk. So far as I was aware it was a conditional operator that means if condition x is true then execute it. Then if it is not true, it executes the next condition. However, in the code

awk '{print $0,(NR>1?$NF-$(NF-1):j)}'

This does not seem to be the case, as isn't it using j as a variable to accumlate a line number? Or am I reading this wrong?