Print N characters in ksh

Hi,

I have this header on a script:

echo "*************************************"

How can I print 1000 "*" characters without to put them on the echo command? Understand?

THIS IS AN EXAMPLE WHAT I NEED:

print "1000 *"

Or is possible to print or echo "*" characters until they fill the line page size?

Thanks

many ways to skin that cat:

nawk 'BEGIN{$1000=OFS="*";print}' < /dev/null
perl -le 'print "*" x 1000'
printf "%01000d"|tr "0" "*"

Hi,

Do you know if it's possible to fill the output line with "*" taking into account the size of the windows you're looking?

Thanks

for example - the others would be similar:

nawk -v width=${COLUMNS} 'BEGIN{$width=OFS="*";print}'

Umm, give me this error on ksh (AIX)

a0@server: /home/a0 # nawk -v width=${COLUMNS} 'BEGIN{$width=OFS="*";print}'
awk: 0602-562 Field $() is not correct.
The source line number is 1.

Any idea of this error?

Really appreciate your help.

Thanks again.

Hmmm... don't have AIX in front of me atm.
if you do echo $COLUMNS from shell, what do you get?
Try:

printf "%0${COLUMNS}d"|tr "0" "*"

Doesn't work on AIX.. but works fine on linux... dont know what's the problem :frowning:

echo $COLUMNS does not retunr nothing..

thanks

Once again..... what does echo ${COLUMNS} return?

---------- Post updated at 11:10 AM ---------- Previous update was at 10:49 AM ----------

---------- Post updated at 11:12 AM ---------- Previous update was at 11:10 AM ----------

make sure that 'resize' is in your $PATH or specify an absolute pathname to it.
try this:

nawk -v width=$(resize | nawk -F'[=;]' '/COLUMNS/{print $2}') 'BEGIN{$width=OFS="*";print}'

DONE!, works perfectly with this last code... :slight_smile:

Thanks a lot!