yaml_to_db - convert a subset of YAML into fsdb
yaml_to_db <source.yaml
Converts a very limited subset of YAML into Fsdb format.
The input is YAML-format (not fsdb). The input is parsed as YAML, assuming the file is an array of dictionary entries. We extract the dictionary names and output this as an fsdb table.
The output is tab-separated fsdb. (Someday more general field separators should be supported.)
This module also supports the standard fsdb options:
-d |
Enable debugging output. |
-i or --input InputSource
Read from InputSource, typically a file name, or "-" for standard input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
-o or --output OutputDestination
Write to OutputDestination, typically a file name, or "-" for standard output, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
--autorun or --noautorun
By default, programs process automatically, but Fsdb::Filter objects in Perl do not run until you invoke the run() method. The "--(no)autorun" option controls that behavior within Perl.
--help
Show help.
--man
Show full manual.
Input:
- name: ACM
role: sponsor
alttext: ACM, the Association for Computing Machinery
image: logos/acm-small.jpg
link: https://www.acm.org/
date: 2016-01-01
- name: SIGCOMM
role: sponsor
alttext: SIGCOMM, ACM'S Special Interest Group on Communication
image: logos/sigcommlogo.png
link: http://sigcomm.org
date: 2016-01-02
- name: SIGMETRICS
role: sponsor
alttext: SIGMETRICS, ACM'S Special Interest Group on Performance Evaluation
image: logos/sigmetrics-small.png
link: http://www.sigmetrics.org
date: 2016-01-03
Command:
yaml_to_db <gnupod.yaml
Output:
#fsdb -F t alttext date image link name role
ACM, the Association for Computing Machinery 2016-01-01 logos/acm-small.jpg https://www.acm.org/ ACM sponsor
SIGCOMM, ACM'S Special Interest Group on Communication 2016-01-02 logos/sigcommlogo.png http://sigcomm.org SIGCOMM sponsor
SIGMETRICS, ACM'S Special Interest Group on Performance Evaluation 2016-01-03 logos/sigmetrics-small.png http://www.sigmetrics.org SIGMETRICS sponsor
# | yaml_to_db
Fsdb.
new
$filter = new Fsdb::Filter::yaml_to_db(@arguments);
Create a new yaml_to_db object, taking command-line arguments.
set_defaults
$filter->set_defaults();
Internal: set up defaults.
parse_options
$filter->parse_options(@ARGV);
Internal: parse command-line arguments.
setup
$filter->setup();
Internal: setup, parse headers.
run
$filter->run();
Internal: run over each rows.
Copyright (C) 2011-2018 by John Heidemann <johnh AT isi DOT edu>
This program is distributed under terms of the GNU general public license, version 2. See the file COPYING with the distribution for details.