Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!uakari.primate.wisc.edu!ark1!nems!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: parsing commands in a makefile Message-ID: <20320@mimsy.umd.edu> Date: 21 Oct 89 15:24:21 GMT References: <4782@ncar.ucar.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 31 In article <4782@ncar.ucar.edu> clyne@redcloud.ucar.edu (John Clyne) writes: >... The syntax for this with sed is something like: > > % sed -e "/patten/a\ > text to append" < in_file > out_file (Note: you need two backslashes in csh. It would be better to show the above as `$ sed -e ...'.) >... The problem is in a makefile all rules must be contained on a single >line. If you try something like the following in a makefile: > >target: > sed -e "/pattern/a\ > text to append" < in_file > out_file >[it fails; is there a workaround?] The only way to do this is indirectly. For instance: sed -e `echo '/pattern/a\Xtext to append' | tr X '\012'` If you are using the !@* Sys5 `interpreting echo', you need to double the backslash. Also, neither `pattern' nor `text to append' can contain an `X'. In general, it is easier to put the `sed' command(s) into a separate file (either with `sh cmdfile.sh' or `sed -f file.of.sed.commands'). -- `They were supposed to be green.' In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris