-
Notifications
You must be signed in to change notification settings - Fork 46
csv output in all commands that produce tables #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It is possible to get CSV (or near enough to CSV) output by piping the JSON output into An example:
with this output
(slightly redacted output) |
Similar results, perhaps better, with
using the |
Here's an example of how you can use the JSON format with $ metal device list -o json | \
jq -r '.[] | .id + "\t" + (.ip_addresses[]| select ((.address_family==4) and .public==true) | .address|tostring) + "\t" + .state + "\t" + .hostname'
3a500289-10d1-49aa-8214-6d0b55818860 203.0.113.54 active test |
What problem are you facing?
For reporting purposes, it's useful to take a data extract from the Packet
system and then import it into a spreadsheet for further analysis.
olekukonko/tablewriter#80 describes how to
use the
tablewriter
package to produce CSV output.How could the Packet CLI help solve this problem?
Add a
--csv
or--output csv
or similar option to formattabular output as tables, with a design goal to import into
Excel or Google Sheets.
Alternatively, document how to reformat the JSON or YAML
output into tabular CSV format.
The text was updated successfully, but these errors were encountered: