STAG-FLATTEN(1)
β¨ NAME β¨
stag-flatten β turns stag data into a flat table. that's it, that's the whole job, and it does it gorgeously π
π SYNOPSIS π
stag-flatten -c name -c person/name dept MyFile.xml
like. look at her. one line and she's already slaying β¨
π DESCRIPTION π
okay so bestie, here's the tea β β stag-flatten reads in a file that's in stag format, and then it 'flattens' it into a tab-delimited table format. it's giving "nested tree, but make it a spreadsheet."
so say you roll up with this data:
(company
(dept
(name "special-operations")
(person
(name "james-bond"))
(person
(name "fred"))))
the command up there in the synopsis will hand you back a two column table, no cap:
special-operations james-bond
special-operations fred
see how it works? the dept name gets repeated for every person inside it. iconic behaviour, honestly π«Ά
β οΈ and here's the part you actually need to remember: if there are multiple values for the columns within the node, then the cartesian product will be calculated. not me doing math in public π but that's literally what happens, so don't be surprised when your row count explodes.
π USAGE π
stag-flatten [-p PARSER] [-c COLS] [-c COLS] NODE <file>
π«Ά ARGUMENTS π«Ά
-p|parser FORMATβFORMATis one ofxml,sxproritext. andxmlassumed as default, so if your file is xml you can just vibe and not mention it πΈ-c|column COL1,COL2,COL3,..β the name of the columns/elements to write out. and bestie you've got two ways to feed her: either specify it with multiple-carguments, or hand over a comma-seperated (no spaces) list of column (terminal node) names after a single-c. pick your fighter, both eat π
π fr fr, watch the spaces. it says no spaces and it means no spaces.
-n|nestβ if set, then the output will be a compress repeating values into the same row; every single cell in the table will be enclosed by{}, and will contain a comma-delimited set of values. so instead of a million rows you get one row with lil curly-brace bundles. obsessed π
π SEE ALSO π
Data::Stagβ go look at the mothership, she's right there π
and that's the whole page, bestie!! this one's running on perl v5.42.0, dated 2025-07-25 β user contributed Perl documentation, section 1 of the manual, and yes she ate and left no crumbs π¦β¨
π¦ where this page comes from
- fedora 43: perl-Data-Stag 0.14-28.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms