groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to run sed in a groff *.mom file?


From: Ingo Schwarze
Subject: Re: How to run sed in a groff *.mom file?
Date: Sun, 27 Oct 2019 18:13:21 +0100
User-agent: Mutt/1.12.2 (2019-09-21)

Hi Joerg,

Boss Hog wrote on Sat, Oct 26, 2019 at 05:33:38PM -0400:
> Andrea wrote:
>> Joerg Klein wrote:

>>> .TH
>>> sed -e -i '1d' alpha.csv
>>> .so alpha.csv
>>> .TE

>> How does groff understand the line starting with sed has to be executed?

> By using one of these requests.
> .pso your_command
> or
> .sy command-line
> 
> With both of these, groff should run in unsafe mode ( groff -U ... )

In addition to the good feedback provided by Ralph Corderoy:

Avoid shelling out from application programs (like groff) whenever
possible.  It makes your document files unsafe to process; in
particular, you can no longer give your source files to others
because those others would have to fear that they might contain
trojan horses.

Instead, always preprocess your input files as needed *before*
passing them to groff.  That also agrees better with the general
UNIX and roff philosophy of using pipelines - even though pipelines
themselves work best for the simple case where only one single file
needs to be processed by multiple filter programs in turn.  But the
basic idea can easily be generalized to the case of handling many
files by storing all input, intermediate, and output files on disk
and using a controlling shell script or the make(1) utility to do
all the required processing in the right order, with running groff(1)
as one of the latest steps.

Yours,
  Ingo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]