[net.unix] how to double space text?

kemp@noscvax.UUCP (03/12/84)

What is the best (simplest, most efficient) way to double space a (simple) text?
I DO NOT want page numbers or other such nroff goodies, just the SIMPLEST
way to double space a text, via a system command such as cat....
  Preferably, the technique should lend itself to scripts and/or pipes.

      Steve Kemp
      Computer Sciences Corp.
      Naval Ocean Systems Center
      San Diego, CA

      kemp@nosc
        -or-
      ...sdcsvax!noscvax!kemp

grt@hocda.UUCP (G.TOMASEVICH) (03/14/84)

The following Bourne shell script double-spaces text.

while read line
do
	echo $line; echo
done

fmw@utah-cs.UUCP (Fred Wilhelmsen) (03/15/84)

I can name that tune in 5 characters.

sed G


To be exact:  sed G infile 

dave@utcsrgv.UUCP (Dave Sherman) (03/15/84)

First way:
	ed file
	g/^/a 
	w
	q
	
Note that there is a blank after the "a" in <<g/^/a >>. Your
editor may not have this feature, but then again it might.

Second way:
Stick
	.nf
	.pl 1
	.ls 2
at the beginning of the file and run it through nroff.

Dave Sherman
Toronto
-- 
 {allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave

johnl@haddock.UUCP (03/16/84)

#R:noscvax:-35500:haddock:16700016:000:194
haddock!johnl    Mar 15 16:07:00 1984

In our (Sys III) system, any of the following double space text:

	pr -t -d [filename]

	awk '{ print $0; print }'

	while read x; do echo "$x\\n"; done

Take your pick.

John Levine, ima!johnl

physics@utcsstat.UUCP (David Harrison) (03/16/84)

Third way to insert blanks:  
	sed 's/$/\
	/
which is copied directly from Kernighan and Pike, page 111

steve%brl-bmd@sri-unix.UUCP (03/16/84)

From:      Stephen Wolff <steve@brl-bmd>

When compiled,
		main(){
			char c;
			while(1){
				putchar(c=getchar());
				if(c=='\n')putchar(c);
			}
		}
works as a filter.  So does

		awk '{print; printf("\n");}'

but neither is blindingly efficient -- except for the programmer.

buck%nrl-css@sri-unix.UUCP (03/16/84)

From:  Joe Buck <buck@nrl-css>

Use awk. The command

awk '{ printf "%s/n/n",$0 }' file

will print file doublespaced. If file is omitted, awk reads the standard
input, so it can be used in pipes.

-Joe

hau@druxi.UUCP (UrrozHA) (03/17/84)

"pr -d -t file" will do the job

merlyn@sequent.UUCP (03/19/84)

ONLY TURKEYS SHOULD GOBBLE THIS LINE... (others can ignore)

>> In our (Sys III) system, any of the following double space text:
>> 
>> 	pr -t -d [filename]
>> 
>> 	awk '{ print $0; print }'
>> 
>> 	while read x; do echo "$x\\n"; done
>> 
>> Take your pick.
>> 
>> John Levine, ima!johnl

Cute... don't try the awk one... it prints EVERY LINE twice, not double
space.  In awk (pretty sure this has been this way since V7, Sys III, X.XBSD
etc.) "print" without args is like "print $0".  Too bad.  print "" works
though.

Randal L. Schwartz, esq. (creator of rediculously long AWK programs)
Sequent Computer Systems, Inc.
UUCP: ...!tektronix!ogcvax!sequent!merlyn
BELL: (503)626-5700

mcferrin@inuxc.UUCP (P McFerrin) (04/06/84)

Our pr(1) command on Unix V has a -d option for double spacing.
If you don't want page numbering and headers, then
	pr -d -t file

		Paul McFerrin