使用 tbl troff/nroff 在 UNIX 中创建表

发布于 2024-10-05 02:08:25 字数 738 浏览 1 评论 0原文

我想从 UNIX(AIX) 中的一些 CSV 文件创建表并将它们作为邮件(消息正文)发送。 我尝试了以下示例 http://www.snake.net/software/troffcvt/tbl.html 但他们都不适合我。

在我运行文件后,

 tbl input-file | troff

我得到的只是这样的东西,(仅粘贴一部分)

V196 Cbr V163 Cbr V130 Cbr n40 0 H240 V388 h689Cbr V370 Cbr V337 Cbr V304 Cbr V271 Cbr V238 Cbr V205 Cbr V172 Cbr V139 Cbr V106 Cbr V73 Cbr V40 Cbr n40 0 x 拖车 V2640 x 停止

我尝试阅读 troff/tbl 的手册页,但没有太多可以进行实验的示例。这里的任何指示都会有帮助。提前致谢。

编辑: 由于它将通过电子邮件发送,我想要 CSV 文件的普通 ASCII 表输出,例如来自 http://www.unix.com/shell-programming-scripting/137830-print-screen- 的用户 drl 帖子table-ascii.html 除了我这里没有 groff :(。

I would like to create tables from some CSV files in UNIX(AIX) and send them as mail(message body).
I tried the examples at
http://www.snake.net/software/troffcvt/tbl.html
but none of them is working for me.

After I run the file as,

 tbl input-file | troff

All I get is something like this,(pasting only a part)

V196 Cbr V163 Cbr V130 Cbr n40 0 H240
V388 h689Cbr V370 Cbr V337 Cbr V304
Cbr V271 Cbr V238 Cbr V205 Cbr V172
Cbr V139 Cbr V106 Cbr V73 Cbr V40 Cbr
n40 0 x trailer V2640 x stop

I've tried reading the man pages for troff/tbl but there aren't much examples that I could experiment on. Any directions here would be helpful. Thanks in advance.

Edit:
As It is going to send via email, I would like to have an ordinary ASCII table output of the CSV file like user drl post from http ://www.unix.com/shell-programming-scripting/137830-print-screen-table-ascii.html except that I don't have groff here :(.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蒗幽 2024-10-12 02:08:25

有两件事:

  1. 您需要使用“-T”选项告诉 troff 您的目标输出格式。查看 groff/troff 手册页以了解支持哪些格式。
  2. troff 的输出是它自己的中间形式,您需要通过后处理器才能获得目标输出格式。

例如,如果您想要 HTML 输出,则需要使用类似的内容

tbl input-file|troff -Thtml | grohtml

如果您想要 Postscript 输出,则需要使用类似的内容

tbl input-file|troff -Tps |grops

troff 后处理器的名称和可用性可能因平台而异,因此请咨询您当地的 troff文档。

Two things:

  1. You need to tell troff which output format you are targeting using the '-T' option. Take a look at the groff/troff man page to see what formats are supported.
  2. troff's output is an intermediate form all its own, which you need to pass through a post processor to get to the target output format.

For example if you wanted HTML output you'd need to use something like

tbl input-file|troff -Thtml | grohtml

If you wanted Postscript output you'd need to use something like

tbl input-file|troff -Tps |grops

The name and availability of troff post-processors may vary slightly from platform to platform, so consult your local troff documentation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文