DEGAS
— Remove excess spaces
and blank lines from text.
Syntax:
DEGAS
/A:
attribs /B:
n /CP:
n /E:
n /H /L /N /P /R /S /T /W
filename…
/A: attribs | attributes mask; valid flags are -ACEHIORS |
/B: n | maximum whitespace characters |
/CP: n | interpret non-Unicode input text using code page n |
/E: n | maximum blank lines |
/H | display filenames |
/L | display line numbers |
/N | disable features |
/P | page output |
/R | remove all blank lines at the start and end of the file |
/RS | remove all blank lines at the start of the file |
/RE | remove all blank lines at the end of the file |
/S | search in subdirectories for matching files |
/T | trim all leading and trailing whitespace from each line |
/W | convert all whitespace characters to ASCII spaces |
… | Range options are also supported. |
The contents of the files will be dumped to standard output, with excess spaces and blank lines removed.
Input filenames may be specified on the command line, or text may be
redirected or piped into DEGAS
. If you want to pipe to
DEGAS
, remember that pipes open a new shell. To pipe to a plugin
command, you must either ensure that the plugin is loaded in the transient
shell, e.g. by installing the .DLL file
in the shell’s PlugIns directory; or else
use temporary files or an in-process pipe.
You may specify more than one filename;
wildcards and directory aliases are supported. You can search recursively into
subdirectories for matching files with /S
. @File lists and
internet files are supported. You may also specify CLIP:
to dump
the clipboard.
/B:
lets you specify the maximum number
of whitespace characters in a row. For example, /B:4
allows no
more than four whitespace characters in a row.
DEGAS
allows for the convention of spacing twice at the end of
a sentence. Specify two numbers separated by a comma:
/B:
n,
m.
The first sets the maximum number of whitespace characters after a period,
question mark, or exclamation point; the second is the maximum after any other
character. /B:2,1
allows up to two spaces at the end of a
sentence, but only one elsewhere.
/E:
specifies the maximum number of blank
lines in a row. (A line containing only whitespace characters is considered a
‘blank line’.) /E:3
allows no more than three blank
lines together. /E:0
removes all blank lines; /E:0
can be abbreviated to /E
.
You can remove all blank lines at the start
of a file with /RS
. Likewise, you can remove all blank
lines at the end of a file with /RE
. /R
does both.
This option is independent of the /E:
compression of blank lines.
/T
strips all leading and trailing
whitespace from each line. This is a separate operation from the
/B:
compression of spaces, and happens
earlier.
If none of /B:
/E:
/R
/RS
/RE
or /W
are specified, the default is
/B:2,1 /E:1
— a maximum of two spaces at the end
of a sentence, one space elsewhere; and no more than one blank line in a row.
/NB | do not write a Byte Order Mark |
/NC | disable highlight |
/ND | do not search into hidden directories; only useful with /S |
/NF | suppress the file-not-found error |
/NJ | do not search into junctions; only useful with /S |
/NZ | do not search into system directories; only useful with /S |
You can combine these, e.g. /NDJ
.