X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f996b,dcac58e0a46e7307 X-Google-Attributes: gidf996b,public X-Google-Thread: 110f55,dcac58e0a46e7307 X-Google-Attributes: gid110f55,public X-Google-Thread: fbb9d,dcac58e0a46e7307 X-Google-Attributes: gidfbb9d,public X-Google-ArrivalTime: 1995-03-08 23:43:14 PST Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!news.uni-stuttgart.de!news.belwue.de!informatik.tu-muenchen.de!lrz-muenchen.de!fauern!rrze.uni-erlangen.de!rachael.franken.de!fu-berlin.de!zrz.TU-Berlin.DE!netmbx.de!unlisys!news.maz.net!news.allcon.net!watson.formel.com!flens.syd.de!sydlink.syd.de!tpki.toppoint.de!nuki.NetUSE.de!Kiel.Germany.EU.net!Hamburg.Germany.EU.net!Germany.EU.net!howland.reston.ans.net!gatech!swrinde!cs.utexas.edu!news.sprintlink.net!news.wwa.com!not-for-mail From: Tony Nugent Newsgroups: alt.ascii-art,alt.binaries.pictures.ascii,rec.arts.ascii Subject: Talk-script-Info: Remove Trailing Blanks Date: 9 Mar 1995 01:43:14 -0600 Organization: Griffith University Brisbane Queensland Australia Lines: 93 Sender: boba@gagme.wwa.com Approved: boba@wwa.com Message-ID: <3jmbii$gsi@gagme.wwa.com> References: <3jl8gk$oi7@gagme.wwa.com> Reply-To: T.Nugent@sct.gu.edu.au NNTP-Posting-Host: gagme.wwa.com Xref: nntp.gmd.de alt.ascii-art:20914 rec.arts.ascii:4315 syb3@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.Nugent@sct.gu.edu.au tnugent@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.Nugent@sct.gu.edu.au tnugent@gucis.cit.gu.edu.au