#!/usr/bin/perl                                                                                                                                                        #$Id: get_jdata_value.pl,v 1.1 2019/08/07 06:41:54 sqko Exp $       
use strict;
use warnings;
unless (@ARGV)
{
    warn <<END;

Program for extracting a specific column value form a specific jdata line.

    Usage:

jdataline | $0 keyname

Where jdataline is a placeholder for any command (or command sequence) which will print one or more
lines from a jdata file.
$0 will then look at the first line input and will extract and print the value corresponding
to the specified keyname.

END
    exit;
}
my $key = shift;
my $line = <STDIN>;
my @l = split(/[\s\t]+/,$line);
for (my $x = 0; $x < @l; $x++)
{
    next unless ($l[$x] eq $key);
    print $l[$x+1],"\n";
    last;
}
