Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!ut-emx!ibmchs!auschs!awdprime!doorstop.austin.ibm.com!tif From: tif@doorstop.austin.ibm.com (Paul Chamberlain) Newsgroups: comp.unix.shell Subject: Re: adjusting string var to fixed length Message-ID: <8193@awdprime.UUCP> Date: 5 Jun 91 13:09:20 GMT References: <1991Jun3.181447.12656@mnemosyne.cs.du.edu> <1991Jun04.144951.28414@sco.COM> Sender: news@awdprime.UUCP Reply-To: tif@doorstop.austin.ibm.com (Paul Chamberlain) Organization: IBM AWD, Austin Lines: 15 In article <1991Jun04.144951.28414@sco.COM> john@sco.COM (John R. MacMillan) writes: >| Could someone please tell me how blanks can be appended to string vars >If the fixed length is relatively short, ... else something like this will do it (width of 75, x's for demonstration): a=abc awk 'BEGIN {printf "x%-75sx\n", "'"$a"'"; }' /dev/null And gives you: xabc x Note that without the "-", it will do right justification. Paul Chamberlain | I do NOT speak for IBM. IBM VNET: PAULCC AT AUSTIN 512/838-9748 | ...!cs.utexas.edu!ibmchs!auschs!doorstop.austin.ibm.com!tif