1

Expand string using nawk

view story
linux-howto

http://www.unix.com – Hello I'm manipulating a file, taking certain variables & printing them to an output file using awk (actually nawk because I'm using -v). I now want to take a field from the input file & expand it to a pre-defined length by preceding the string with spaces. The field I'm picking up can be of variable length. So some possible values of the field ($29 in my line of code below) are: 5.60 7.80 12.90 121.50 The resulting field has to be 20 chars in length. The first & second fields need 16 spaces at the start, the 3rd needs 15 & the last 14. Can I do this mani (HowTos)