adjusting string var to fixed length
Conor P. Cahill
cpcahil at virtech.uucp
Tue Jun 4 09:29:47 AEST 1991
rchattam at isis.cs.du.edu (King Chattam) writes:
> Could someone please tell me how blanks can be appended to string vars
>to make it fixed length?
The following will do what you want:
a=abc
t="`expr \"$a \" : \"\(..........\)\"`"
echo "x${t}x"
You will get: "xabc x" which is $a plus 7 blanks. The x's are only
used to mark the string so you can see that the blanks actually are there.
--
Conor P. Cahill (703)430-9247 Virtual Technologies, Inc.
uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160
Sterling, VA 22170
More information about the Comp.unix.shell
mailing list