Original Usenet thread from rec.arts.ascii, started 6 Mar 1995.
Script: Centering
rec.arts.ascii
· 1 message · 6 Mar 1995
> Does anybody have a script that centers text or pictures or whatever? > I know this is only a really simple tr command, but I can't figure it out > right now. :) Thanks... Try this: ========8<----insert-crowbar-here------------------------------- #!/usr/bin/awk -f # centre all input text on an 80-column line { if ( length < 78 ) { le = ( 80-length ) / 2 ; for ( i=1 ; i<=le ; i++ ) { printf(" ") }; } print $0 } ========8<----insert-crowbar-here------------------------------ Seems to work ok for me :-) If you haven't got an 80-column display, or don't want to centre between columns 1 and 80, then this should be able to be modified so that it can take paramaters to set the centering margins. Hope this is useful. Cheers Tony _______________________________________________________ _______| Tony Nugent | Griffith University |______ \ | | Brisbane, Queensland, Australia | / \ |-------------------------------------------------------| / > | T.N...@sct.gu.edu.au tnu...@gucis.cit.gu.edu.au | < / |_______________________________________________________| \ /__________) (_________\ Kelly: " Mom, when I grow up I want to be just like you. I want to do nothing, I want to be nothing." -=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
Related ASCII art in the Gallery
Explore these categories from our collection of 11,000+ artworks:
_________
/___ ___\
//@@@\ /@@@\\
\\@@@/ \@@@//
\___ " ___/
| - |
\_/ jrjc ______
/|_||_\`.__
( _ _ _\
=`-(_)--(_)-'
hjw .="=. _/.-.-.\_ ( ( o o ) ) |/ " \| \'---'/jgs /`"""`\\
_________ | _____ |\ | |\ ___| | \ | | | | | | | | |___| | | \ | |____\| | \|_________| Andy Johnson
__ _ o'')}____// `_/ ) (_(_/-(_/
[>====]
Make your own ASCII art
Turn images, text or 3D into ASCII, or draw your own – right in your browser.
About this thread.
These messages were posted publicly to the newsgroup
rec.arts.ascii
in 1995 and are mirrored here unchanged as part of the Historic Archives – only email addresses are masked.
The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can.
Are you one of the authors? Contact us to get your posts attributed, connected to your artist profile, or removed.
Report this message
Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.