Output Formats

THIS PAGE CONTAINS INFORMATION FOR VERSION 2.0

There are several different output formats available in FBCMD:

 col column format.  This format puts fields in columns, with each record in a row.  Tries to WRAP the output to appear nice on your screen.
 csvcol csv column format.  This is the same as col, but with no wrapping and using CSV formatting.
 rec record format.  This multi-row format can show multiple fields per record, listing the field names (keys) in one column, and the values in another column.  Tries to WRAP the output to appear nice on your screen.
 csvrec csv record format. This is the same as rec, but with no wrapping and using CSV formatting.
 csv csv format.  This format creates a column for each field, with a each record in a row.  (Obviously) uses CSV formatting.
 json json format.
 php php code format.  This format generates php-compatible code.
 serial php serialized format.
 yaml ymal format. (Only if the yaml module has been installed)

The output format is controlled on the command line by the preference -output_format or simply -o for short. For example:
fbcmd command -o=json
For each command, there is a default output format: -output_format_command. The -o preference will override the default for the command.

CONTROLLING THE FIELDS SHOWN

You can control which fields are shown by using the -output_show preference, or -oshow.  You can use -oshow=all to view all the fields:
fbcmd posts -o=rec -oshow=all
or you can be very specific:
fbcmd posts -o=rec -oshow=index,message,story,likes.count
Note that it uses the . to specify field.subfield notation.
Pro Tip: It uses regular expressions to match field names, so if you want all the likes information, use: (may need the quotes in unix)
fbcmd posts -o=rec "-oshow=index,message,story,likes.*"

THE COL FORMAT

The col and csvcol formats will only show the fields specified by the -output_col (-ocol) preference (use -oshow=all with -o=col).
fbcmd posts -o=csvcol -ocol=index,likes.count,message,story
Note that in posts, some posts have a message field, while others have a story field.  Use the message/story syntax to specify the (prioritized) list of fields that will share the column.
fbcmd posts -o=csvcol -ocol=index,likes.count,message/story
For the col output format, you need to specify the width of the column: you can omit one, which will try to auto-fit to your screen.
fbcmd posts -o=col -ocol=index:6,likes.count:3,message/story
The rec and csvrec use a similar format -output_rec (-orec), except that it has special "fields" key and value.  It will loop through all the fields in the record (according to -show) and fill in the keys (field names) and values.

FLATTENING THE OUTPUT

For the object-based output formats, you can flatten structure so it doesn't have nested objects with -output_flat=1 (-oflat=1), or you can set the default for each type:
-output_json_flat  -output_php_flat  -output_serial_flat  -output_yaml_flat

OTHER OUTPUT OPTIONS

-output_header
-output_pad
-output_rec_crumbs
-output_rec_space
-output_wrap_env_var
-output_wrap_min_width
-output_wrap_width
-csv_header
-csv_bookend
-csv_escaped_bookend
-csv_force_bookends
-csv_newline_subst
-csv_separator

Comments