By downloading this code you agree to the
Source Code Use License (PDF). |
{ version = 1.05; (* of rb.p 2022 Apr 12}
(* begin module describe.rb *)
(*
name
rb: remove blanks from ends of lines in a file
synopsis
rb(input: stdin, output: out)
files
input: a text file
output: a copy of fin with trailing blanks removed from all lines,
any blank lines at the end of the file will also be removed.
Tabs are counted as blanks.
description
Blanks can creep onto the end of lines in a file without one knowing it,
either by the computer system, from transportation or an editor. This
program removes those blanks, so that less storage is needed for the
file. Some programs require that there be no blank lines in the file, yet
transportation can generate blank lines at the end of the file. This
program will remove such lines.
The method for doing this is interesting since it can be done in
one pass. Read in characters and write them out. If a character
is a blank, don't output it just yet, instead count the number of
blanks. If a non-blank character appears on the line, write out
the previously held blanks. But if one gets to the end of the line
... forget to write out any blanks that were counted up!
The original rembla program uses fin and fout files. This rb version
uses input and output to allow it to be used in Unix pipes:
rb < myinputfile > my outputfile
or
... | rb | sort | ...
see also
Description of what stdin means:
shell.p
file version: rembla.p
author
Thomas D. Schneider
bugs
none known
*)
(* end module describe.rb *)
{This manual page was created by makman 1.45}
{created by htmlink 1.62}