Skip Menu |

This queue is for tickets about the App-DPath CPAN distribution.

Report information
The Basics
Id: 76018
Status: resolved
Priority: 0/
Queue: App-DPath

People
Owner: Nobody in particular
Requestors: rafl [...] debian.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Please provide a UNIX shell friendly output format
Date: Sat, 24 Mar 2012 15:32:24 +0100
To: bug-App-DPath [...] rt.cpan.org
From: Florian Ragwitz <rafl [...] debian.org>
The currently provided output formats, YAML, JSON, INI, and Data::Dumper, are great for munging data into a format that can later be processed by full-fledged programs. However, they're much less easy to process with the standard UNIX tools, to which, I'd like to think, dpath would make a very decent companion in theory. Having a simple, textual, and line based output format that lends itself well to processing by the standard suite of UNIX tools, would be lovely, even if it'd just cover emitting certain kinds of simple data.
Download (untitled)
application/pgp-signature 197b

Message body not shown because it is not plain text.

On Sat Mar 24 10:32:33 2012, FLORA wrote: Show quoted text
> Having a simple, textual, and line based output format that lends > itself well to processing by the standard suite of UNIX tools, > would be lovely, even if it'd just cover emitting certain kinds > of simple data.
Any preference from what CPAN provides? I just output data structures with other modules. Steffen -- Steffen Schwigon <ss5@renormalist.net> Dresden Perl Mongers <http://dresden-pm.org/>
Thanks for the report. Since v0.04 I now provide a dedicated output format "flat" which serves that purpose. It flattens typical combinations of scalar/array/hash results up to max nesting level 2 in a way that should be useful for typical grep/cut/sed/awk handling. Try: $ echo "" ; for p in '//firstname' '//metadata' '//metadata//Affe' '//reports' '//reports//Affe' '//UnsupportedInnermostHash' '//UnsupportedInnermostArray' ; do echo $p ; curl -SskL https://raw.github.com/renormalist/app-dpath/master/t/flatabledata.yaml | dpath -o flat $p ; echo "" ; done //firstname Affe Tiger Birne //metadata Affe:coolness=big;size=average Eric:The flat one from the 90s Zomtec:coolness=bit anachronistic;size=average Birne:bissel;hinterher;manchmal //metadata//Affe coolness:big size:average //reports line A-1;line A-2;line A-3;line A-4;line A-5 line B-1;line B-2;line B-3;line B-4 line C-1;line C-2;line C-3 Affe=amazing moves in the jungle;Zomtec=slow talking speed;Birne=unexpected in many respects single report string //reports//Affe amazing moves in the jungle //UnsupportedInnermostHash dpath: unsupported innermost nesting (HASH) for 'flat' output. //UnsupportedInnermostArray dpath: unsupported innermost nesting (ARRAY) for 'flat' output. Regards, Steffen -- Steffen Schwigon <ss5@renormalist.net> Dresden Perl Mongers <http://dresden-pm.org/>