Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet thread from alt.ascii-art, started 8 Mar 1995.
 _   _                     _        _             _     _           
| | | |___  ___ _ __   ___| |_     / \   _ __ ___| |__ (_)_   _____ 
| | | / __|/ _ \ '_ \ / _ \ __|   / _ \ | '__/ __| '_ \| \ \ / / _ \
| |_| \__ \  __/ | | |  __/ |_   / ___ \| | | (__| | | | |\ V /  __/
 \___/|___/\___|_| |_|\___|\__| /_/   \_\_|  \___|_| |_|_| \_/ \___|
Request: Script to Remove Trailing Blanks

Request: Script to Remove Trailing Blanks

alt.ascii-art · 4 messages · 8 Mar 1995 - 9 Mar 1995
Bob Allison <bob...@gagme.wwa.com> ASCII art 8 Mar 1995 06:27 · permalink · report
	Well, seeing as I received so much help from Tony about the centering
text script, I figured I'd ask about another. One thing that I seem to spend
a lot of time doing is manually removing trailing blanks from ASCII pics. So,
what I'm asking is: does anyone have a script that does this, or does anyone
have any ideas on how to go about it (Tony? ;) )? Thanks for any help. :) Oh,
I've just had an idea: I could just mail it through the Figlet mailing
list... :-)

  ___  _                      _a' /(   <.  Simon Bradley, Knight Protector!
 / __><_>._ _ _  ___ ._ _  ~~ _}\ \(  _  ) E-mail: syb...@aber.ac.uk
 \__ \| || ' ' |/ . \| ' |       \(._(.)'  Finger: syb...@osfb.aber.ac.uk
 <___/|_||_|_|_|\___/|_|_|      ._>. _>.   WWW: http://www.aber.ac.uk/~syb3/

Simon Bradley <syb...@aber.ac.uk> ASCII art 8 Mar 1995 21:44 · permalink · report
	Well, seeing as I received so much help from Tony about the centering
text script, I figured I'd ask about another. One thing that I seem to spend
a lot of time doing is manually removing trailing blanks from ASCII pics. So,
what I'm asking is: does anyone have a script that does this, or does anyone
have any ideas on how to go about it (Tony? ;) )? Thanks for any help. :) Oh,
I've just had an idea: I could just mail it through the Figlet mailing
list... :-)

  ___  _                      _a' /(   <.  Simon Bradley, Knight Protector!
 / __><_>._ _ _  ___ ._ _  ~~ _}\ \(  _  ) E-mail: syb...@aber.ac.uk
 \__ \| || ' ' |/ . \| ' |       \(._(.)'  Finger: syb...@osfb.aber.ac.uk
 <___/|_||_|_|_|\___/|_|_|      ._>. _>.   WWW: http://www.aber.ac.uk/~syb3/

In article <3jl8gk$oi...@gagme.wwa.com>, Simon Bradley <syb...@aber.ac.uk> wrote:
>
>        Well, seeing as I received so much help from Tony about the centering
>text script, I figured I'd ask about another. One thing that I seem to spend
>a lot of time doing is manually removing trailing blanks from ASCII pics. So,
>what I'm asking is: does anyone have a script that does this, or does anyone
>have any ideas on how to go about it (Tony? ;) )? Thanks for any help. :) Oh,
>I've just had an idea: I could just mail it through the Figlet mailing
>list... :-)

>  ___  _                      _a' /(   <.  Simon Bradley, Knight Protector!
> / __><_>._ _ _  ___ ._ _  ~~ _}\ \(  _  ) E-mail: syb...@aber.ac.uk
> \__ \| || ' ' |/ . \| ' |       \(._(.)'  Finger: syb...@osfb.aber.ac.uk
> <___/|_||_|_|_|\___/|_|_|      ._>. _>.   WWW: http://www.aber.ac.uk/~syb3/

If you are using ms-win. I can mail you my utility to do the job.
Sy

Tony Nugent <T.N...@sct.gu.edu.au> ASCII art 9 Mar 1995 07:43 · permalink · report
syb...@aber.ac.uk (Simon Bradley) writes:

>	Well, seeing as I received so much help from Tony about the centering
>text script, I figured I'd ask about another. One thing that I seem to spend

(Funny... I've only seen the first of my messages about this
posted so far... I presume the other one with *both* scripts will
eventually appear in rec.arts.ascii.  We don't carry the
alt.[*]ascii.* groups here)-:

>a lot of time doing is manually removing trailing blanks from ASCII pics. So,
>what I'm asking is: does anyone have a script that does this, or does anyone
>have any ideas on how to go about it (Tony? ;) )? Thanks for any help. :) Oh,
>I've just had an idea: I could just mail it through the Figlet mailing
>list... :-)

Hehe... why didn't you ask me directly Simon?  :-)))

Ok, instead of awk, let's use sed...

========8<----cut-all-above-this-line-and-keep-all-below-------
#!/bin/sh
#
# stripspaces
#
# Strip trailing spaces from the end of input lines.
# Tony Nugent  T.N...@sct.gu.edu.au  tnu...@gucis.cit.gu.edu
#
sed -e 's/[\ ]*$//'
========8<----cut-all-below-this-line-and-keep-all-above-------

Easy, no?   :)

To understand the syntax of the regular expression used there,
refer to the man pages for ed (and sed, grep, awk, etc).

Oh, for those that may ask (as I had a couple of people ask
about my awk centering scripts), this (once again) is a unix
shell script.  Cut it out and save as a file, then
"chmod +x stripspaces" to make it exectuable.

The script will then take either standard input or a file
redirected into it, and output the result on standard output
(which can then be piped to something else or sent to a new file
or appened to an existing one).

example% cat asciipic.txt | stripspaces >>! fixed.pics

or, better still:

example% stripspaces < asciipic.txt >>! fixed.pics

which does the same thing without a useless use of cat...  file
asciipic.txt will be sent to the script to strip the spaces off
the end of each line, then the result appended to the file
fixed.pics; this file will be created if it didn't already exist.

If you use vi, then the following ex command will filter the
current file through the script:

:1,$!stripspaces

(Ain't vi powerful?  I use vim btw, an *excellent* vi clone! :)

My apologies to those that already know these unix basics.

IF YOU USE DOS:
~~~~~~~~~~~~~~
This script (and the awk ones posted earlier that center lines)
can be easily adapted for any decent dos ports of sed (and
awk).  Such animals can be found at garbo or SimTel (or their
many mirror sites):

oak.oakland.edu :: /SimTel/msdos/gnuish/ (or ~/textutil/ or ~/fileutil/).
                   (Check the file 00_index.txt in each dir).

garbo.uwasa.edu :: /pc/txtutil/ (or /pc/fileutil/ etc).
                   (Again, check the file 00index.txt).

BTW, dos ports of awk can be found in the same places, as well as
the /SimTel/msdos/awk/ directory.

Cheers
Tony
  Tony Nugent  Griffith University, Brisbane, Queensland, Australia
  // \\          // \\  // \\          // \\  // \\  // \\          // \\  //
 \': | \\      // | :,\\': | \\      // | :,\\': | \': | \\      // | :,\\': |
  \\ | | \\  // | | //  \\ | | \\  // | | //  \\ | |\\ | | \\  // | | //  \\ |
    \\ | :,\\': | //      \\ | :,\\': | //      \\ | \\ | :,\\': | //      \\
      \\ //  \\ //          \\ //  \\ //          \\  \\ //  \\ //          \\
               T.N...@sct.gu.edu.au  tnu...@gucis.cit.gu.edu.au

About this thread. These messages were posted publicly to the newsgroup alt.ascii-art 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.

Help classify this post