ymask - Mask a data structure to display only the desired fields
version 0.033
ymask <mask> [<file>...] ymask -h|--help|--version
This program takes a stream of YAML documents (on STDIN or file arguments), and prints only the fields specified by the mask.
mask
See MASK SYNTAX for more information
A YAML file to read. The special file "-" refers to STDIN. If no files are specified, read STDIN.
Show this help document.
Print the current ymask and Perl versions.
$ ymask 'name,rank,serial'
Select multiple properties in a document using ,. If a property does not exist, nothing will be added (and no error or warning will be output).
,
$ ymask 'squad/name'
Select an inner document's properties using /. Arrays are automatically looped over.
/
$ ymask 'squad(name,location)'
Select multiple parts of an inner document by using parentheses.
$ ymask 'squad/*/city'
Select every property in a document, which is useful for picking parts out of every inner document.
All these examples use the following documents:
--- name: Hazel Murphy role: Captain nickname: Hank history: - location: Sealab from: 2014-01-01 - location: USS Hunley from: 2012-06-01 to: 2013-11-28 --- name: Quinn Quinlan role: Science Officer nickname: Doctor history: - location: Sealab from: 2014-04-01 - location: MIT from: 2008-08-01 to: 2012-06-05 --- name: Debbie Dupree role: Oceanographer history: - location: Sealab from: 2014-02-10 - location: Sea Parks from: 2004-09-01 to: 2014-01-20
$ ymask 'name,role,nickname' --- name: Hazel Murphy nickname: Hank role: Captain --- name: Quinn Quinlan nickname: Doctor role: Science Officer --- name: Debbie Dupree role: Oceanographer
$ ymask 'name,history/location' --- history: - location: Sealab - location: USS Hunley name: Hazel Murphy --- history: - location: Sealab - location: MIT name: Quinn Quinlan --- history: - location: Sealab - location: Sea Parks name: Debbie Dupree
Specify the default format Yertl uses between commands. Defaults to yaml. Can be set to json for interoperability with other programs.
yaml
json
Data::Partial::Google - The implementation of this command
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2016 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install ETL::Yertl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ETL::Yertl
CPAN shell
perl -MCPAN -e shell install ETL::Yertl
For more information on module installation, please visit the detailed CPAN module installation guide.