Sponsored Content
Top Forums Shell Programming and Scripting [TIP] Processing YAML files with yq Post 303040438 by stomp on Tuesday 29th of October 2019 11:17:35 AM
Old 10-29-2019
I just read that yq is not a standalone script, but does only a data transition from YAML to JSON and then feeds the data into jq with the user-given jq-expression and thus relies on jq to be installed. It comes with another tool named xq which works the same way with XML.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Processing files within a directory one by one

Hi How to create a shell script which takes in to account all the files present within a directory DIR one by one e.g. suppose i have a directory named DIR where there are files with the extension .ABC i want to create shell script which processes all these files one by one. ... (1 Reply)
Discussion started by: skyineyes
1 Replies

2. Shell Programming and Scripting

Two files processing

I have the following two files: 1st File: 1:1:100 2:101:400 3:401:450 4:451:600 5:601:980 6:981:1500 7:1501:1600 8:1601:1800 9:1801:2000 2nd File: 30 50 80 700 (2 Replies)
Discussion started by: moutaz1983
2 Replies

3. Shell Programming and Scripting

Processing files

Hi I have the folowing input file, the file looks like below sftp> . .. archive x001_ameint*.zip x001_ameint_1.zip x001_ameint_2.zip x001_REPORTS*.zip x001_REPORTS_1.zip sftp> I want my output to look like this x001_ameint*.zip x001_ameint_1.zip x001_ameint_2.zip (1 Reply)
Discussion started by: ramky79
1 Replies

4. Programming

problems iterating in RUBY while extracting info from YAML, Pls help!

Hi all, I am stuck with a ruby script that extracts detials from yaml file and processes accordingly. the yaml file confivnic: device: vnic1: policy: - L2 mode: active vnic2: policy: - L3 - L4 mode: active type: aggr ... (1 Reply)
Discussion started by: wrapster
1 Replies

5. Shell Programming and Scripting

get all files from a directory and pass the files for processing

Hi All, I have a directory in which there will be several files. i want to get all the files and pass it to a piece of code for processing on the files. This is the piece of code which does the processing. tr "\n" "|" < (log file name) | tr "$" "\n" > output echo ' ' >>output while... (1 Reply)
Discussion started by: suresh_kb211
1 Replies

6. Shell Programming and Scripting

Processing files using awk

Hi I have files in our UNIX directory like the below -rw-r--r-- 1 devinfo devsupp 872 Sep 14 02:09 IMGBTREE27309_12272_11_1_0_FK.idx0 -rw-r--r-- 1 devinfo devsupp 872 Sep 14 02:09 IMGBTREE27309_12272_11_0_0_PK.idx0 -rw-r--r-- 1 devinfo devsupp 432 Sep 14... (7 Replies)
Discussion started by: rbmuruga
7 Replies

7. UNIX for Dummies Questions & Answers

Cygwin Errors: Yaml Configuration issues

Hi everyone! Hope all of you will be fine. I am new to this forum. Well, I am trying to configure yaml-0.1.4 in cygwin on Windows 7. I have written the following command: *******/tmp/yaml-0.1.4 $ ./configure --prefix=/usr && make && make install and the following error appeared. ... (3 Replies)
Discussion started by: imdalucky1
3 Replies

8. Shell Programming and Scripting

Processing of log files

Hi, I have typical logs file something of these formats - fn2013.12.13.log fn2013.12.13_a.log fn2013.12.13_b.log suffix part is after the underscore ( ie a.log or b.log ) I need to process the files in ascending date order, but descending suffix order, and check if the file exist and... (12 Replies)
Discussion started by: scott_apc
12 Replies

9. Shell Programming and Scripting

YAML file update

removing post since it got fix (1 Reply)
Discussion started by: kishore150
1 Replies

10. UNIX for Beginners Questions & Answers

[Tip] Housekeeping Tasks Made Easy - User Home directories and Leftover Files

We have regularly questions about how to create users and user accounts. But regularly user accounts need to be deleted too. It is quite easy to delete the user account itself but usually the HOME directory of the user remains. It is good style to remove these directories but simply deleting... (3 Replies)
Discussion started by: bakunin
3 Replies
Parse::CPAN::Meta(3)					User Contributed Perl Documentation				      Parse::CPAN::Meta(3)

NAME
Parse::CPAN::Meta - Parse META.yml and META.json CPAN metadata files SYNOPSIS
############################################# # In your file --- name: My-Distribution version: 1.23 resources: homepage: "http://example.com/dist/My-Distribution" ############################################# # In your program use Parse::CPAN::Meta; my $distmeta = Parse::CPAN::Meta->load_file('META.yml'); # Reading properties my $name = $distmeta->{name}; my $version = $distmeta->{version}; my $homepage = $distmeta->{resources}{homepage}; DESCRIPTION
Parse::CPAN::Meta is a parser for META.json and META.yml files, using JSON::PP and/or CPAN::Meta::YAML. Parse::CPAN::Meta provides three methods: "load_file", "load_json_string", and "load_yaml_string". These will read and deserialize CPAN metafiles, and are described below in detail. Parse::CPAN::Meta provides a legacy API of only two functions, based on the YAML functions of the same name. Wherever possible, identical calling semantics are used. These may only be used with YAML sources. All error reporting is done with exceptions (die'ing). Note that META files are expected to be in UTF-8 encoding, only. When converted string data, it must first be decoded from UTF-8. METHODS
load_file my $metadata_structure = Parse::CPAN::Meta->load_file('META.json'); my $metadata_structure = Parse::CPAN::Meta->load_file('META.yml'); This method will read the named file and deserialize it to a data structure, determining whether it should be JSON or YAML based on the filename. On Perl 5.8.1 or later, the file will be read using the ":utf8" IO layer. load_yaml_string my $metadata_structure = Parse::CPAN::Meta->load_yaml_string($yaml_string); This method deserializes the given string of YAML and returns the first document in it. (CPAN metadata files should always have only one document.) If the source was UTF-8 encoded, the string must be decoded before calling "load_yaml_string". load_json_string my $metadata_structure = Parse::CPAN::Meta->load_json_string($json_string); This method deserializes the given string of JSON and the result. If the source was UTF-8 encoded, the string must be decoded before calling "load_json_string". yaml_backend my $backend = Parse::CPAN::Meta->yaml_backend; Returns the module name of the YAML serializer. See "ENVIRONMENT" for details. json_backend my $backend = Parse::CPAN::Meta->json_backend; Returns the module name of the JSON serializer. This will either be JSON::PP or JSON. Even if "PERL_JSON_BACKEND" is set, this will return JSON as further delegation is handled by the JSON module. See "ENVIRONMENT" for details. FUNCTIONS
For maintenance clarity, no functions are exported. These functions are available for backwards compatibility only and are best avoided in favor of "load_file". Load my @yaml = Parse::CPAN::Meta::Load( $string ); Parses a string containing a valid YAML stream into a list of Perl data structures. LoadFile my @yaml = Parse::CPAN::Meta::LoadFile( 'META.yml' ); Reads the YAML stream from a file instead of a string. ENVIRONMENT
PERL_JSON_BACKEND By default, JSON::PP will be used for deserializing JSON data. If the "PERL_JSON_BACKEND" environment variable exists, is true and is not "JSON::PP", then the JSON module (version 2.5 or greater) will be loaded and used to interpret "PERL_JSON_BACKEND". If JSON is not installed or is too old, an exception will be thrown. PERL_YAML_BACKEND By default, CPAN::Meta::YAML will be used for deserializing YAML data. If the "PERL_YAML_BACKEND" environment variable is defined, then it is intepreted as a module to use for deserialization. The given module must be installed, must load correctly and must implement the "Load()" function or an exception will be thrown. SUPPORT
Bugs should be reported via the CPAN bug tracker at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Parse-CPAN-Meta> AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2006 - 2010 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.16.3 2012-04-05 Parse::CPAN::Meta(3)
All times are GMT -4. The time now is 01:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy