Sponsored Content
Full Discussion: array in awk
Top Forums Shell Programming and Scripting array in awk Post 302523735 by rocket_dog on Thursday 19th of May 2011 03:33:39 PM
Old 05-19-2011
I tried the following with no luck:
Code:
awk 'NR==FNR{a[$0]; next} $6 in a{print > "/path/to/${ARRAY[i]}/" $6 "/newfile"}' /path/to/arrayfile file

could there be an issue with the syntax in the way I am using ${ARRAY[i]} as in /path/to/${ARRAY[i]}/ ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Array in awk

Hi, How can find Array is NULL or not. i wrote script using arrays but i want dislpy an message if arrary was Empty. pls help me on this. (2 Replies)
Discussion started by: koti_rama
2 Replies

2. Shell Programming and Scripting

array on awk

I have a raw data file: 70,1,1,-53.25 70,1,1,,,,-57.50 70,1,1,,,,,,,,,,-48.00 I want to have a output file with the formatting below: 70,1,1,-53.25,,,,-57.50,,,,,-48.00 I mean if these rows have the first similar three variables which will be group into one row. And I try to write a... (1 Reply)
Discussion started by: anhtt
1 Replies

3. Shell Programming and Scripting

Use of AWK as array

Dear Experts, I have a file containing text like below 123 456 789 012 345 I want to save each line in array. and print each array index as per my requirement. For Example array will print 456 array will print 012 Thanks for your Help. (14 Replies)
Discussion started by: Danish Shakil
14 Replies

4. Shell Programming and Scripting

AWK help. how to compare a variable with a data array in AWK?

Hi all, i have a data array as follows. array=ertfgj2345 array=456ttygkd . . . array=errdjt3235 so number or elements in the array can varies depending on how big the data input is. now i have a variable, and it is $1 (there are $2, $3 and so on, i am only interested in $1). ... (9 Replies)
Discussion started by: usustarr
9 Replies

5. Shell Programming and Scripting

array in awk

hi, can somebody explain me this? probably i am overlooking something but i dont know what why is not printed "7 9 11" instead of this? $ echo "" | awk '{for(i=1;i<=3;i++){j=7;a=j;j=j+2;} print a,a,a; }' 7 7 7thanks (2 Replies)
Discussion started by: erik80
2 Replies

6. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

7. Shell Programming and Scripting

Array from awk

I'm trying to get the output from awk into a bash array. Here is my script. #!/bin/bash while : do app=$( osascript -e "tell application \"System Events\" to return name of every process whose frontmost is true" ) echo "$app" if ava ]] then ps -ax | grep -v awk | pids=( $(awk... (5 Replies)
Discussion started by: nextyoyoma
5 Replies

8. Shell Programming and Scripting

How to Assign an shell array to awk array?

Hello All, Can you please help me with the below. #!/bin/bash ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1" ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5... (14 Replies)
Discussion started by: Ariean
14 Replies

9. Shell Programming and Scripting

awk loop using array:wish to store array values from loop for use outside loop

Here's my code: awk -F '' 'NR==FNR { if (/time/ && $5>10) A=$2" "$3":"$4":"($5-01) else if (/time/ && $5<01) A=$2" "$3":"$4-01":"(59-$5) else if (/time/ && $5<=10) A=$2" "$3":"$4":0"($5-01) else if (/close/) { B=0 n1=n2; ... (2 Replies)
Discussion started by: klane
2 Replies

10. UNIX for Beginners Questions & Answers

awk array

Hello. I'm trying to figure out which one of these is not true about an awk array. -You do not need to formally declare an array; it is created automatically on first assignment -Array elements can only be addressed using an index ... (1 Reply)
Discussion started by: Eric7giants
1 Replies
Log::Report::Lexicon::PO(3pm)				User Contributed Perl Documentation			     Log::Report::Lexicon::PO(3pm)

NAME
Log::Report::Lexicon::PO - one translation definition DESCRIPTION
This module is administering one translation object. Sets of PO objects are kept in a POT file, implemented in Log::Report::Lexicon::POT. METHODS
Constructors Log::Report::Lexicon::PO->new(OPTIONS) -Option --Default automatic "" comment [] format [] fuzzy false msgid <required> msgid_plural undef msgstr "" or [] references [] automatic => PARAGRAPH Automatically added comments. See addAutomatic(). comment => PARAGRAPH Translator added comments. See addComment(). format => ARRAY-OF-PAIRS|HASH See format(). fuzzy => BOOLEAN The string is not yet translated, some smart guesses may have been made. See fuzzy(). msgid => STRING msgid_plural => STRING msgstr => STRING|ARRAY-OF-STRING The translations for the msgid. When msgid_plural is defined, then an ARRAY must be provided. references => STRING|ARRAY-OF-LOCATIONS The STRING is a blank separated list of LOCATIONS. LOCATIONs are of the form "filename:linenumber", for instance "lib/Foo.pm:42" See addReferences() Attributes $obj->addAutomatic(LIST|ARRAY|STRING) Add multiple lines to the translator's comment block. Returns an empty string if there are no comments. $obj->addComment(LIST|ARRAY|STRING) Add multiple lines to the translator's comment block. Returns an empty string if there are no comments. $obj->addFlags(STRING) Parse a "flags" line. $obj->addReferences(STRING|LIST|ARRAY) The STRING is a blank separated list of LOCATIONS. The LIST and ARRAY contain separate LOCATIONs. A LOCATION is of the form "filename:linenumber". Returns the internal HASH with references. $obj->automatic([LIST|ARRAY|STRING]) Returns a STRING which contains the cleaned paragraph of automatically added comments. If an argument is specified, it will replace the current comment. $obj->comment([LIST|ARRAY|STRING]) Returns a STRING which contains the cleaned paragraph of translator's comment. If an argument is specified, it will replace the current comment. $obj->format(LANGUAGE|PAIRS|ARRAY-OF-PAIRS|HASH) When one LANGUAGE is specified, it looks whether a "LANGUAGE-format" or "no-LANGUAGE-format" is present in the line of FLAGS. This will return 1 (true) in the first case, 0 (false) in the second case. It will return "undef" (also false) in case that both are not present. You can also specify PAIRS: the key is a language name, and the value is either 0, 1, or "undef". example: use of format() if($po->format('c')) ... unless($po->format('perl-brace')) ... if(defined $po->format('java')) ... $po->format(java => 1); # results in 'java-format' $po->format(java => 0); # results in 'no-java-format' $po->format(java => undef); # results in '' $obj->fuzzy([BOOLEAN]) Returns whether the translation needs human inspection. $obj->isActive Returns whether the translation has any references, or is the header. $obj->msgid Returns the actual msgid, which cannot be "undef". $obj->msgstr([INDEX, [STRING]]) With a STRING, a new translation will be set. Without STRING, a lookup will take place. When no plural is defined, use INDEX 0 $obj->plural([STRING]) Returns the actual msgid_plural, which can be "undef". $obj->references([STRING|LIST|ARRAY]) Returns an unsorted list of LOCATIONS. When options are specified, then those will be used to replace all currently defined references. Returns the unsorted LIST of references. $obj->removeReferencesTo(FILENAME) Remove all the references to the indicate FILENAME from the list. Returns the number of refs left. Parsing Log::Report::Lexicon::PO->fromText(STRING, [WHERE]) Parse the STRING into a new PO object. The WHERE string should explain the location of the STRING, to be used in error messages. $obj->toString(OPTIONS) Format the object into a multi-lined string. -Option --Default nr_plurals undef nr_plurals => INTEGER If the number of plurals is specified, then the plural translation list can be checked for the correct length. Otherwise, no smart behavior is attempted. $obj->unused The message-id has no references anymore and no translations. SEE ALSO
This module is part of Log-Report distribution version 0.94, built on August 23, 2011. Website: http://perl.overmeer.net/log-report/ LICENSE
Copyrights 2007-2011 by Mark Overmeer. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.14.2 2012-03-02 Log::Report::Lexicon::PO(3pm)
All times are GMT -4. The time now is 03:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy