Image of Modern Operating Systems (3rd Edition)
Image of XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer)
Image of Operating System Concepts
Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)

Create a Repeated String

This question is often asked in the various Unix and Linux forums. For example, suppose you want to create a string of 50 asterisks other than str=”***********************************” Here are some of the ways I have come across over the years. perl -e ‘print “*”x50’ ruby -e ‘puts “*”*50’ awk ‘BEGIN { while (a++<50) s=s “x”; print s }’ printf ‘%*s’ “50” ‘ ‘ | tr ‘ ‘ “*” echo “*****” | sed ‘s/.*/&&&&&&&&&&/’ The following works for gawk but not oawk. echo | awk NF=51 OFS=*