🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #178

Re: script to center text

#178
From: Harald.Eikrem
Date: Tue, 28 Jul 1992 23:36
20 lines
1076 bytes
This is a possible sed centering solution, but them y'know, I'm a sed
loonie.....
Note that the very first substitution trades any tabs for 4 spaces,
because there wont be a single *correct* way to interpret a tab after
the centering operation has taken place....

===================
#!/bin/sh

sed '
	s/	/    /g
	s/^  *//
	s/  *$//
	: fill
	/.............................................................................../!s/.*/ & /
	t fill
' $@
===================

  ~~harald E.
Technical Details
Message-ID: <1992Jul28.233633*Harald.Eikrem@delab.sintef.no>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!ugle.unit.no!news
References: <AeRB8p600WB60JlPZc@andrew.cmu.edu> <josef.712322528@uranium> <1992Jul28.151623.12798@news.eng.convex.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!ugle.unit.no!news
From: Harald.Eikrem@delab.sintef.no
Subject: Re: script to center text
In-Reply-To: tchrist@convex.COM's message of 28 Jul 92 15:16:23 GMT
Message-ID: <1992Jul28.233633*Harald.Eikrem@delab.sintef.no>
Followup-To: comp.unix.shell
Sender: news@ugle.unit.no (NetNews Administrator)
Organization: SINTEF DELAB, Trondheim, Norway.
References: <AeRB8p600WB60JlPZc@andrew.cmu.edu> <josef.712322528@uranium>
 <1992Jul28.151623.12798@news.eng.convex.com>
Date: 28 Jul 92 23:36:33
Lines: 20