ed script "here" document in a Makefile

fitz at rpi.edu fitz at rpi.edu
Mon Jan 7 12:28:43 AEST 1991


This shell script with an ed script splits my file into two new files:

ed foo <<E_O_F
1,/^ *References$/-1w foo.body
/^ *References$/+1,$w foo.ref
q
E_O_F

This makefile does the same thing for me:

EDSCRIPT= 1,/^ *References$$/-1w $(DOC).body@\
/^ *References$$/+1,$$w $(DOC).ref@\
q

ed:	$(DOC)
	echo '$(EDSCRIPT)' | tr @ '\012' | ed $(DOC)

My question: Can a makefile rule contain a "here" document like my
first example?  Please post tested solutions that use the standard
"ed", "sh", and "make".  Thanks!

Brian Fitzgerald



More information about the Comp.unix.shell mailing list