在 ubuntu 中向 XML 文件添加换行符

Adding line break to XML file in ubuntu

我在 ubuntu 机器上保存了一个 XML 文件。但是,当我尝试使用 gedit 打开它时,显示的所有内容都没有换行符。我的问题很简单,如何在 XML 文件中添加换行符?

干杯,

Ch.

您的 XML 文件是 RAW 格式。

xmlindent.

可以将其格式化得更明显、更易于阅读
sudo apt-get install xmlindent

然后像这样应用它:

cat file.xml | xmlindent -f -t > output.xml

您可以省略 -f-t 选项。

  • -t代表"use tabulator instead of spaces"和
  • -f 表示在 <tag />.
  • 等空标签上添加新行