putting comments in nroff/troff--var

BlandMA mab at druxp.UUCP
Sat Sep 8 06:23:19 AEST 1984


>
>	In particular, it would be *really nice* to be able to put comments in
>	/etc/passwd, and in L.sys, and in sed(1) scripts (any sed scripts).

I've written some non-trivial programs using sed(1), and my technique
for including "comments" is by including them as patterns that will
never match, effectively making them nops.  Example:

	/-- this is a sed "comment" --/d
	/### here is another comment/p

Of course, if the input happens to contain the text between slashes,
the command following the slash will get executed.  Thus, it's not foolproof,
but it can be used for commenting sed scripts when you know enough about
the input to choose your comments wisely.  This technique also wastes cpu
cycles, since the comments are scanned as patterns, but if I were that
concerned about cycles, I wouldn't use sed for some jobs.
--
	Alan Bland (ihnp4!druxp!mab)
	AT&T-ISL Denver



More information about the Comp.unix mailing list