To integrate with other executables, a executable may launch another executable and capture its output from stdout.
But most programs writes the output message to stdout in custom format and usually in human readable format.
So it requires the system integrator to write a function to parse the output, which is considered trouble and the parser code may be buggy.
Do you think this is old fashioned? Most Unix-style programs do that.
Very few programs write to stdout in standard format such as XML or JSON, which is more modern.
Example: Veracity (DVCS) writes JSON to stdout.
Should we switch to use modern formats?
For a console program, human readable or easy parsable: which is more important ?
Not trying to sound crotchety here, but one line per record, with fields in columns or delimited so they can be easily parsed by cut without writing custom code, is a standard format, and was a deliberate design decision. Read Eric S. Raymond’s The Art of Unix Programming sometime. It will increase your appreciation for innovations that we now take for granted, and has whole chapters on the importance of output that is easily human readable. A format still being around and widely used after 40 years is a sign of its strength, not its weakness.
A common approach is to use command line flags to make an output format that is easy for both humans and computers to parse. Look at the git porcelain output formats for a good example.
One situation where xml or json is recommended, however, is when your data is arbitrarily nested instead of something easily put into rows. That determination should be made on a case by case basis. Xml is better than binary formats, but still not as readable as a plain text table.
2
Parsing any form of output can be buggy. Just because the output format follows a specific format does not guarantee correct semantics. If you have the source for the executables, you can change the output into whatever format you desire. If you do not, but the executable otherwise meets your needs, you suck it up and parse the output.
1