How can I parse the OS X terminal command output defaults read?
it displays the "old" format of the NeXTSTEP player; things that look like this:
{
"Apple Global Domain" = {
AppleAntiAliasingThreshold = 4;
AppleCollationOrder = root;
I tried to write the output to a file and convert it using plutil, but it suffocates:
> defaults read > defaults.txt
> plutil -convert xml1 defaults.txt
2014-02-02 21:29:14.856 plutil[56896:707] CFPropertyListCreateFromXMLData(): Old-style
plist parser: missing semicolon in dictionary on line 10835. Parsing will be abandoned.
Break on _CFPropertyListMissingSemicolon to debug.
defaults.txt: Property List error: Unexpected character { at line 1 / JSON error: No
value for key in object around character 28.
why, you ask?
I would like to keep the default values in git, so I can save the record as a change and diff parameter after making the changes, but it seems that serialization in is defaults readnot a stable line string: dictionaries do not reset your keys in sequential order, causing a huge amount of noise. if I can parse defaults read, I can then output the data through a sequential serial follower.