1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.0.3, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- This manual documents GNU troff version 1.23.0.
Copyright � 1994-2023 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled "GNU Free
Documentation License". -->
<title>Invocation Examples (The GNU Troff Manual)</title>
<meta name="description" content="Invocation Examples (The GNU Troff Manual)">
<meta name="keywords" content="Invocation Examples (The GNU Troff Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Request-Index.html" rel="index" title="Request Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Invoking-groff.html" rel="up" title="Invoking groff">
<link href="Paper-Format.html" rel="prev" title="Paper Format">
<style type="text/css">
<!--
div.example {margin-left: 3.2em}
span.r {font-family: initial; font-weight: normal; font-style: normal}
-->
</style>
</head>
<body lang="en">
<div class="section-level-extent" id="Invocation-Examples">
<div class="nav-panel">
<p>
Previous: <a href="Paper-Format.html" accesskey="p" rel="prev">Paper Format</a>, Up: <a href="Invoking-groff.html" accesskey="u" rel="up">Invoking <code class="code">groff</code></a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Request-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Invocation-Examples-1">2.6 Invocation Examples</h3>
<a class="index-entry-id" id="index-invocation-examples"></a>
<a class="index-entry-id" id="index-examples-of-invocation"></a>
<p><code class="code">roff</code> systems are best known for formatting man pages. Once a
<code class="command">man</code> librarian program has located a man page, it may execute
a <code class="code">groff</code> command much like the following.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">groff -t -man -Tutf8 /usr/share/man/man1/groff.1
</pre></div></div>
<p>The librarian will also pipe the output through a pager, which might not
interpret the SGR terminal escape sequences <code class="command">groff</code> emits for
boldface, underlining, or italics; see the <cite class="cite">grotty<span class="r">(1)</span></cite> man page
for a discussion.
</p>
<p>To process a <code class="code">roff</code> input file using the preprocessors
<code class="command">gtbl</code> and <code class="command">gpic</code> and the <samp class="file">me</samp> macro package in the
way to which AT&T <code class="code">troff</code> users were accustomed, one would type (or
script) a pipeline.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">gpic foo.me | gtbl | gtroff -me -Tutf8 | grotty
</pre></div></div>
<p>Using <code class="command">groff</code>, this pipe can be shortened to an equivalent
command.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">groff -p -t -me -T utf8 foo.me
</pre></div></div>
<p>An even easier way to do this is to use <code class="command">grog</code> to guess the
preprocessor and macro options and execute the result by using the
command substitution feature of the shell.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">$(grog -Tutf8 foo.me)
</pre></div></div>
<p>Each command-line option to a postprocessor must be specified with any
required leading dashes ‘<samp class="samp">-</samp>’
because <code class="command">groff</code> passes the arguments as-is to the postprocessor;
this permits arbitrary arguments to be transmitted. For example, to
pass a title to the <code class="command">gxditview</code> postprocessor,
the shell commands
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">groff -X -P -title -P 'trial run' mydoc.t
</pre></div></div>
<p>and
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">groff -X -Z mydoc.t | gxditview -title 'trial run' -
</pre></div></div>
<p>are equivalent.
</p>
</div>
<hr>
<div class="nav-panel">
<p>
Previous: <a href="Paper-Format.html">Paper Format</a>, Up: <a href="Invoking-groff.html">Invoking <code class="code">groff</code></a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Request-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|