Sponsored Content
Top Forums Shell Programming and Scripting need help with nawk using -v vars Post 96810 by amon on Tuesday 24th of January 2006 01:50:49 AM
Old 01-24-2006
hello guys I finallly solved that problem...

it should be like this

nawk -F"|" -v x=$2 '
BEGIN { print "A party|B party|Vrijeme|Duration|AccountBalance|Charge|" }
{ if($15 ~ /'$2'/) {{apary=$15; bparty=$23; vrijeme=$4; duration=$43; account=$65; charge=$66}
{ print apary"|"bparty"|"vrijeme"|"duration"|"account"|"charge }}
}
END {print "bla bla bla "} ' $1 >>$2

so output should be just fiields 15 23 4 43 65 and 66 and comprered with value on field $15..


Thanks all for reading this post
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Env vars in a SED script

Hello, <Preamble> I'm writing an installation script for use with PKGADD. What I want to do is take one of the variables set in the REQUEST script and use that in the install script so I can change applications configuration. My install script is as follows: sed ' /^DIRNAME/ i\... (8 Replies)
Discussion started by: Bags
8 Replies

2. Shell Programming and Scripting

Passing Vars between scripts

Im running a script that runs scripts within it self and i need to pass vars made in the original script to scripts run within it and the only way i can think to do it is right the string to a file and read the file in the script (4 Replies)
Discussion started by: rcunn87
4 Replies

3. Shell Programming and Scripting

NEW: need help with nawk using -v vars

I'm trying to pass nawk a shell variable to be used in a pattern match. I can't get this work. I'm calling nawk from a /bin/sh I want that when somebody enters Trunk Group in variable TGR so it goes into nawk variable TG. echo "Enter TRUNK GROUP:" read TGR cat... (20 Replies)
Discussion started by: wakhan
20 Replies

4. Shell Programming and Scripting

how to access values of awk/nawk variables outside the awk/nawk block?

i'm new to shell scripting and have a problem please help me in the script i have a nawk block which has a variable count nawk{ . . . count=count+1 print count } now i want to access the value of the count variable outside the awk block,like.. s=`expr count / m` (m is... (5 Replies)
Discussion started by: saniya
5 Replies

5. Shell Programming and Scripting

check a list of vars

I have about 20 different variables that I need to check for null values then replace with a specific string if they are null. I've been doing this via 20 different if then statements like this: if ; then WIND="UUU" fi Is there a more elegant way to do this? The vars aren't sequential in... (6 Replies)
Discussion started by: audiophile
6 Replies

6. Shell Programming and Scripting

getting vars from external files

Hi I have an issue, I want to get variables from an external file. Variable file var1=test var2-test2 I want to get these vars from another shell script. Does any one know how? (5 Replies)
Discussion started by: digitalviking
5 Replies

7. Shell Programming and Scripting

List of Shell Env Vars

Hia, echo ${!S*} gives me all those env vars starting with S like SHELL SECONDS SHELLOPTS SHLVL etc. is there any way to deflate the shell variables' range like echo ${!A-E*} OR echo ${!A..S*} to list all env vars starting within range of A till E. Thanks Regards, Nasir (1 Reply)
Discussion started by: busyboy
1 Replies

8. Shell Programming and Scripting

Nawk Problem - nawk out of space in tostring on

Hi.. i am running nawk scripts on solaris system to get records of file1 not in file2 and find duplicate records in a while with the following scripts -compare nawk 'NR==FNR{a++;next;} !a {print"line"FNR $0}' file1 file2duplicate - nawk '{a++}END{for(i in a){if(a-1)print i,a}}' file1in the middle... (12 Replies)
Discussion started by: Abhiraj Singh
12 Replies

9. Shell Programming and Scripting

Read vars iteratively

Hello, I have a tab delimited list of 311 server & account names which I want to read those 2 variables and then connect to each server and get info on that particular job account. I've tried the following: while read server acct; do printf "********$server\t $acct***********\n" ... (3 Replies)
Discussion started by: mcbobolink
3 Replies
HTML::Microformats::Datatype::Duration(3pm)		User Contributed Perl Documentation	       HTML::Microformats::Datatype::Duration(3pm)

NAME
HTML::Microformats::Datatype::Duration - floating periods of time SYNOPSIS
my $duration = HTML::Microformats::Datatype::Duration->new($d); print "$duration "; DESCRIPTION
Constructors "$d = HTML::Microformats::Datatype::Duration->new($duration)" Creates a new HTML::Microformats::Datatype::Duration object. $duration is a DateTime::Duration object. "$d = HTML::Microformats::Datatype::Duration->parse($string, $elem, $context)" Creates a new HTML::Microformats::Datatype::Duration object. $string is a duration represented in ISO 8601 format, for example: 'P1Y' or 'PT2H29M58.682S'. $elem is the XML::LibXML::Element being parsed. $context is the document context. The standard way of representing durations in Microformats is as an ISO 8601 string: <abbr class="duration" title="P4DT4H">4 and a half days</abbr> This constructor also supports a number of experimental microformat duration patterns. ISO-31 class names are supported: <div class="duration"> <span claa="d">4</span> and <abbr title="12" class="h">a half</abbr> days. </div> As are metric/SI measures (in seconds): <span class="duration">124 s</span> <span class="duration">124</span> seconds Or using an hMeasure microformat with no 'item' property, the 'type' property either absent or a case-insensitive match of 'duration' and a unit property of 's'/'sec'/'seconds', 'min'/'minutes', 'h'/'hours' or 'd'/'days'. For example: <span class="duration hmeasure"> <b class="unit">Days</b>: <span class="num">4.5</span> </span> Public Methods "$d->duration" Returns a DateTime::Duration object. "$d->to_string" Returns an ISO 8601 formatted string representing the duration. "$d->datatype" Returns an the RDF datatype URI representing the data type of this literal. Functions "compare($a, $b)" Compares durations $a and $b. Return values are as per 'cmp' (see perlfunc). Note that there is not always a consistent answer when comparing durations. 30 days is longer than a month in February, but shorter than a month in January. Durations are compared as if they were applied to the current datetime (i.e. now). This function is not exported by default. Can also be used as a method: $a->compare($b); "$c = add($a, $b)" Adds two durations together. This function is not exported by default. Can also be used as a method: $c = $a->add($b); "$c = subtract($a, $b)" Subtracts duration $b from $a. This function is not exported by default. Can also be used as a method: $c = $a->subtract($b); BUGS
Please report any bugs to <http://rt.cpan.org/>. SEE ALSO
HTML::Microformats, HTML::Microformats::Datatype, DateTime::Duration. AUTHOR
Toby Inkster <tobyink@cpan.org>. COPYRIGHT
Copyright 2008-2011 Toby Inkster This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. perl v5.14.2 2011-12-06 HTML::Microformats::Datatype::Duration(3pm)
All times are GMT -4. The time now is 09:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy