views:

51

answers:

1

I am looking for any papers, implementations, or just general ideas about common linux/unix utilities writing/reading structured output/input.

The structured output could be anything, xml, jsopn, yaml, etc.

This question: http://stackoverflow.com/questions/703163/formatting-shell-output-into-structured-data

asks pretty much what I am asking, but is answered away with a different answer than the question intended and what I am looking for.

+1  A: 

It's not very common, but I know of 2 instances. Subversion can do it:

$ svn status --xml wc

outputs

<?xml version="1.0"?>
<status>
<target
   path="wc">
<entry
   path="qax.c">
<wc-status
   props="none"
   item="added"
   revision="0">
</wc-status>
</entry>
<entry
   path="bar.c">
<wc-status
   props="normal"
   item="modified"
   revision="965">
<commit
   revision="965">
<author>sally</author>
<date>2008-05-28T06:35:53.048870Z</date>
</commit>
</wc-status>
</entry>
</target>
</status>

and XMLStarlet does a lot:

$ xmlstarlet ls

prints

<xml>
<d a="rwxr-xr-x" acc="2004.02.13 00:06:03" mod="2004.02.13 00:06:00" sz="4096"  n="."/>
<d a="rwxr-xr-x" acc="2004.02.12 23:54:35" mod="2004.02.13 00:00:09" sz="4096"  n=".."/>
<f a="rw-r--r--" acc="2004.02.12 23:54:58" mod="2004.02.12 23:54:58" sz="0"     n="resume.xml"/>
<f a="rw-r--r--" acc="2004.02.12 23:54:58" mod="2004.02.12 23:54:58" sz="0"     n="resume-2004.xml"/>
<d a="rwxr-xr-x" acc="2004.02.13 00:04:52" mod="2004.02.13 00:04:52" sz="4096"  n="old-resumes"/>
</xml>
James Roth
I never really found anything else. The operating system Plan 9 has a whole system for IPC and exchanging data, but is just that a whole system not just standard tools outputting structured data. Accepting your answer and moving on..