Script: Centering
From Tony Nugent <T.N...@SCT.GU.EDU.AU>
· rec.arts.ascii
· 6 Mar 1995 08:32 · View full thread
· report
> 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." -=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fbb9d,d847f7124236aa31,start X-Google-Attributes: gidfbb9d,public X-Google-ArrivalTime: 1995-03-06 23:44:45 PST Path: bga.com!news.sprintlink.net!news.wwa.com!not-for-mail From: Tony Nugent <T.N...@SCT.GU.EDU.AU> Newsgroups: rec.arts.ascii Subject: Script: Centering Date: 6 Mar 1995 02:32:35 -0600 Organization: SCT.GU.EDU.AU Lines: 41 Sender: bob...@gagme.wwa.com Approved: bob...@wwa.com Message-ID: <3jehb3$ju...@gagme.wwa.com> NNTP-Posting-Host: gagme.wwa.com
Related ASCII art in the Gallery
Explore these categories from our collection of 11,000+ artworks:
Make your own ASCII art
Turn images, text or 3D into ASCII, or draw your own – right in your browser.
About this message.
This message was posted publicly to the newsgroup
rec.arts.ascii
in 1995 and is 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 the author? 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.