Here are handy scripts for printing drafts of files. They double-space or triple-space file(s) or standard input. For example:
%doublespace afile | lp
%prog | triplespace | lp
doublespace triplespace | Here they are: |
---|
doublespace triplespace #!/bin/sed -f #!/bin/sed -f G G G
No, that isn't a typo: both scripts just use the sed command G (34.24). The G command appends a newline and the contents of sed's hold space, which will be empty in this script. The effect is to add a newline after every newline; two Gs add two newlines.
That file doesn't even use a shell, so it's efficient; the kernel
starts sed directly (45.3)
and gives it the script itself as the input file expected with the
-f option.
If your UNIX can't execute files directly with #!
, type
in these versions
instead:
doublespace triplespace exec /bin/sed G ${1+"$@"} exec /bin/sed 'G;G' ${1+"$@"}
They start a shell, then
exec replaces the shell with sed (45.7).
The ${1+"$@"}
works around a
problem with argument handling (46.7)
in some Bourne shells.
And now you know how to make quadruplespace,
quintuplespace, ... :-)
.
-