adjusting string var to fixed length

John R. MacMillan john at sco.COM
Wed Jun 5 00:49:51 AEST 1991


|  Could someone please tell me how blanks can be appended to string vars
|to make it fixed length?

If the fixed length is relatively short, something like the following
in sh/ksh will do:

var=foo
# Pad to 10:   10 spaces        10 dots
var=`expr "$var          " : '\(..........\).*'`



More information about the Comp.unix.shell mailing list