Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Awk: Performing "for" loop within text block with two files Post 303029144 by MadeInGermany on Tuesday 22nd of January 2019 10:56:04 AM
Old 01-22-2019
You mean loop through the fields and each lookup in the array, like this?
Code:
  if ($1 == "Lexeme") {
    for (b=2; b<=NF; b++) if ($b in B) PR3 = 1
  }

Also, do you want to search <Co> in all the records? Or only in the records that matched with $1? then it should be
Code:
  if (($1 in A) && /<Co>/) PR1 = 1

or (again) loop through the fields and compare each field:
Code:
  if ($1 in A) {
    for (b=2; b<=NF; b++) if ($b == "<Co>") PR1 = 1
  }

This User Gave Thanks to MadeInGermany For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Printing "END" before a new loop in AWK

First off, I have been learning AWK by trial and error over the last week or so, and there are some gaps in my basic understanding of the language. Here is my situation: I am coding and outputting results from an experiment I conducted in Psyscope, which has all been compiled into a master file.... (2 Replies)
Discussion started by: ccox85
2 Replies

2. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

3. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

4. Shell Programming and Scripting

"Join" or "Merge" more than 2 files into single output based on common key (column)

Hi All, I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations: 1. I am restrained to 2 input files only. 2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
Discussion started by: Katabatic
1 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Get values from 2 files - Complex "for loop and if" awk problem

Hi everyone, I've been thinking and trying/changing all day long the below code, maybe some awk expert could help me to fix the for loop I've thought, I think I'm very close to the correct output. file1 is: <boxes content="Grapes and Apples"> <box No.="Box MT. 53"> <quantity... (8 Replies)
Discussion started by: Ophiuchus
8 Replies

7. Shell Programming and Scripting

Using sed to find text between a "string " and character ","

Hello everyone Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
Discussion started by: haggismn
10 Replies

8. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

9. Shell Programming and Scripting

For Loop Field editing - without using "awk"

Hi, I'm using Linux and bash shell. I have a file (F1.txt) with contents like Table1 Column1 123abc Table1 Column2 xyz Table2 Column1 543 Now, I would like to get the output as UPDATE Table1 SET Column1='123abc'; UPDATE Table1 SET Column2='xyz'; UPDATE Table2 SET Column1='543';... (3 Replies)
Discussion started by: Dev_Dev
3 Replies

10. Shell Programming and Scripting

Using "for" loop within "awk"

Hi Team. I am trying to execute a simple for loop within an awk but its giving a different result. Below is the main code: awk '{for(i=1;i<=6;i++) print $i}'The result should be 1 2 3 4 5 6 but its not giving this result. Can someone please help? (3 Replies)
Discussion started by: chatwithsaurav
3 Replies
Font::TTF::GSUB(3)					User Contributed Perl Documentation					Font::TTF::GSUB(3)

NAME
Font::TTF::GSUB - Module support for the GSUB table in conjunction with TTOpen DESCRIPTION
Handles the GSUB subtables in relation to Ttopen tables. Due to the variety of different lookup types, the data structures are not all that straightforward, although I have tried to make life easy for myself when using this! INSTANCE VARIABLES
The structure of a GSUB table is the same as that given in Font::TTF::Ttopen. Here we give some of the semantics specific to GSUB lookups. ACTION_TYPE This is a string taking one of 4 values indicating the nature of the information in the ACTION array of the rule: g The action contains a string of glyphs to replace the match string by l The action array contains a list of offsets and lookups to run, in order, on the matched string a The action array is an unordered set of optional replacements for the matched glyph. The application should make the selection somehow. o The action array is empty (in fact there is no rule array for this type of rule) and the ADJUST value should be added to the glyph id to find the replacement glyph id value MATCH_TYPE This indicates which type of information the various MATCH arrays (MATCH, PRE, POST) hold in the rule: g The array holds a string of glyph ids which should match exactly c The array holds a sequence of class definitions which each glyph should correspondingly match to o The array holds offsets to coverage tables CORRESPONDANCE TO LAYOUT TYPES
The following table gives the values for ACTION_TYPE and MATCH_TYPE for each of the 11 different lookup types found in the GSUB table definition I have: 1.1 1.2 2 3 4 5.1 5.2 5.3 6.1 6.2 6.3 ACTION_TYPE o g g a g l l l l l l MATCH_TYPE g g c o g c o Hopefully, the rest of the uses of the variables should make sense from this table. METHODS
$t->read_sub($fh, $lookup, $index) Asked by the superclass to read in from the given file the indexth subtable from lookup number lookup. The file is positioned ready for the read. $t->extension Returns the table type number for the extension table $t->out_sub($fh, $lookup, $index) Passed the filehandle to output to, suitably positioned, the lookup and subtable index, this function outputs the subtable to $fh at that point. AUTHOR
Martin Hosken Martin_Hosken@sil.org. See Font::TTF::Font for copyright and licensing. perl v5.16.3 2011-10-13 Font::TTF::GSUB(3)
All times are GMT -4. The time now is 09:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy