2025-03-14 21:59:59 -06:00
|
|
|
|
# textutil
|
|
|
|
|
|
|
|
|
|
|
|
> 用于操作各种格式的文本文件。
|
2026-02-18 06:55:01 -07:00
|
|
|
|
> 更多信息:<https://keith.github.io/xcode-man-pages/textutil.1.html>。
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
|
|
- 显示有关 `foo.rtf` 的信息:
|
|
|
|
|
|
|
|
|
|
|
|
`textutil -info {{foo.rtf}}`
|
|
|
|
|
|
|
|
|
|
|
|
- 将 `foo.rtf` 转换为 `foo.html`:
|
|
|
|
|
|
|
2026-08-06 22:19:46 -06:00
|
|
|
|
`textutil -convert html {{foo.rtf}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
|
|
- 将带格式的 rtf 文本转换为普通 txt 文本:
|
|
|
|
|
|
|
2026-08-06 22:19:46 -06:00
|
|
|
|
`textutil {{foo.rtf}} -convert txt`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
|
|
- 将 `foo.txt` 转换为 `foo.rtf`, 字体使用 Times 字号 10:
|
|
|
|
|
|
|
2026-08-06 22:19:46 -06:00
|
|
|
|
`textutil -convert rtf -font Times -fontsize 10 {{foo.txt}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
|
|
- 加载当前目录中的所有 RTF 文件,连接其内容,并将结果作为 `index.html` 写入,HTML 标题设置为"多个文件":
|
|
|
|
|
|
|
|
|
|
|
|
`textutil -cat {{html}} -title "多个文件" -output {{index.html}} *.rtf`
|