Relational data can be converted to various formats and one of them is the XML.
This is a good option for further processing e.g. using XSLT transformation or passing the XML data to some other tool.
Just use relpipe-out-xml
instead of relpipe-out-tabular
and the rest of the pipeline remains unchanged:
ssh example.com cat /etc/mtab | relpipe-in-fstab | relpipe-out-xml
Will produce XML like this:
<?xml version="1.0" encoding="UTF-8"?>
<relpipe xmlns="tag:globalcode.info,2018:relpipe">
<relation>
<name>fstab</name>
<attributes-metadata>
<attribute-metadata name="scheme" type="string"/>
<attribute-metadata name="device" type="string"/>
<attribute-metadata name="mount_point" type="string"/>
<attribute-metadata name="type" type="string"/>
<attribute-metadata name="options" type="string"/>
<attribute-metadata name="dump" type="integer"/>
<attribute-metadata name="pass" type="integer"/>
</attributes-metadata>
<record>
<attribute name="scheme" type="string">UUID</attribute>
<attribute name="device" type="string">29758270-fd25-4a6c-a7bb-9a18302816af</attribute>
<attribute name="mount_point" type="string">/</attribute>
<attribute name="type" type="string">ext4</attribute>
<attribute name="options" type="string">relatime,user_xattr,errors=remount-ro</attribute>
<attribute name="dump" type="integer">0</attribute>
<attribute name="pass" type="integer">1</attribute>
</record>
<record>
<attribute name="scheme" type="string"></attribute>
<attribute name="device" type="string">/dev/sr0</attribute>
<attribute name="mount_point" type="string">/media/cdrom0</attribute>
<attribute name="type" type="string">udf,iso9660</attribute>
<attribute name="options" type="string">user,noauto</attribute>
<attribute name="dump" type="integer">0</attribute>
<attribute name="pass" type="integer">0</attribute>
</record>
<record>
<attribute name="scheme" type="string"></attribute>
<attribute name="device" type="string">/dev/sde</attribute>
<attribute name="mount_point" type="string">/mnt/data</attribute>
<attribute name="type" type="string">ext4</attribute>
<attribute name="options" type="string">relatime,user_xattr,errors=remount-ro</attribute>
<attribute name="dump" type="integer">0</attribute>
<attribute name="pass" type="integer">2</attribute>
</record>
<record>
<attribute name="scheme" type="string">UUID</attribute>
<attribute name="device" type="string">a2b5f230-a795-4f6f-a39b-9b57686c86d5</attribute>
<attribute name="mount_point" type="string">/home</attribute>
<attribute name="type" type="string">btrfs</attribute>
<attribute name="options" type="string">relatime</attribute>
<attribute name="dump" type="integer">0</attribute>
<attribute name="pass" type="integer">2</attribute>
</record>
<record>
<attribute name="scheme" type="string"></attribute>
<attribute name="device" type="string">/dev/mapper/sdf_crypt</attribute>
<attribute name="mount_point" type="string">/mnt/private</attribute>
<attribute name="type" type="string">xfs</attribute>
<attribute name="options" type="string">relatime</attribute>
<attribute name="dump" type="integer">0</attribute>
<attribute name="pass" type="integer">2</attribute>
</record>
</relation>
</relpipe>
Thanks to XSLT, this XML can be easily converted e.g. to an XHTML table (table|tr|td
) or other format.
Someone can convert such data to a (La)TeX table.
n.b. the format is not final and will change i future versions (XML namespace, more metadata etc.).
Relational pipes, open standard and free software © 2018-2022 GlobalCode