Sponsored Content
Top Forums Shell Programming and Scripting need a logic to start with awk/ sh Post 302231193 by user_prady on Monday 1st of September 2008 09:35:51 PM
Old 09-01-2008
Quote:
Originally Posted by user_prady
Thanks genious Annihilannic .. Really appriciate your logic..

Can You Please give a brief idea what does this statement for
Code:
txdata[txaddr,++txindex[txaddr]]

I guess this is a 2D array but when I print that only it gives me error.

Regards,
user_prady

my friend Its seems to be not working for this case

INFILE

Code:
     120 : TXADDR  : 00000000
     240 : TXDATA  0000000000000011
     280 : TXDATA  0000000000000012
     320 : TXDATA  0000000000000013
     360 : TXDATA  0000000000000014
    1080 : TXADDR  : 00000000
    1200 : TXDATA  0000000000000001
    1240 : TXDATA  0000000000000002
    1280 : TXDATA  0000000000000003
    1320 : TXDATA  0000000000000004
    2002 : RXADDR  : 00000000
    2040 : TXADDR  : 00000020
    2160 : TXDATA  0000000000000011
    2200 : TXDATA  0000000000000012
    2240 : TXDATA  0000000000000013
    2280 : TXDATA  0000000000000014
    2281 : RXDATA  0000000000000001
    2321 : RXDATA  0000000000000002
    2361 : RXDATA  0000000000000003
    2401 : RXDATA  0000000000000004

OUTPUT
Code:
rxdata 0000000000000001 for address 00000000 does not match transmitted: 0000000000000011
rxdata 0000000000000003 for address 00000000 does not match transmitted: 0000000000000012
rxdata 0000000000000003 for address 00000000 does not match transmitted: 0000000000000013
rxdata 0000000000000004 for address 00000000 does not match transmitted: 0000000000000014

Here the in the above input file same address (i.e, in address 00000000 I am writting twice and reading the data once and the lastest data are matching with the read data but in my programme its saying not matching)

Pls give me a suggestion ..

Regards,
Pradyumna
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cannot get logic for concatenation awk

Hello friends, I have a problem in printing an array.. Example if my array line contains 4 elements like following line=0002 , line=202200, line=200002, line= 300313 Now one = sprintf line line line line will concatenate my whole array to one. But I am not sure about the... (7 Replies)
Discussion started by: user_prady
7 Replies

2. Shell Programming and Scripting

need a logic for awk programming

Hello Friends, I have a txt file like below //*Init Start Reg(read,12'h42E,16'h0000); Nop(5628.5); //*Init End //*Main Start Reg(read,12'h42E,16'h0000); Nop(5628.5); //*Main End I want to calculate the values between //* Init Start & //* Init End And //*Main Start & //*Main... (5 Replies)
Discussion started by: user_prady
5 Replies

3. Shell Programming and Scripting

Help with awk logic

I want to print lines that have "IND" or "ind" or nothing in field 2 or 3 file: output needed: Code i wrote: nawk -F"," '{if(tolower($2||$3) ~"ind"||"")print}' file Help is appreciated (3 Replies)
Discussion started by: pinnacle
3 Replies

4. Shell Programming and Scripting

need an awk script/logic

In one data file i have values like this a b c 1 2 e f g 2 3 i j k 3 5 I need to sum up the last 2 columns and make a data file...How i can do that. a b c 1 2 e f g 2 3 i j k 3 5... (8 Replies)
Discussion started by: bobprabhu
8 Replies

5. UNIX for Dummies Questions & Answers

Need help in logic using awk command

I have task to find out the min,max, average value of each service for example i searched for " StatementService " $awk '/VST.*StatementService:/{print $3,$4,$19,$22,$25}' performance.log > smp.log $cat smp.log amexgtv VST: : StatementService:1860 StatementService:getCardReference:0... (3 Replies)
Discussion started by: senthil.ak
3 Replies

6. UNIX for Dummies Questions & Answers

awk logic and math help

Hi, My file has 2 fields and millions of lines. variableStep chrom=Uextra span=25 201 0.5952 226 0.330693 251 0.121004 276 0.0736858 301 0.0646982 326 0.0736858 401 0.2952 426 0.230693 451 0.221004 476 0.2736858 Each field either has a... (6 Replies)
Discussion started by: wyarosh
6 Replies

7. Shell Programming and Scripting

How to use this logic with awk?

Hi friends, I am having 2 files, I just want to compare 2 files each containing 2 columns 1st column is lat, and 2nd column is long, if anyone can understand below logic please help me in writing script with awk.. here each field of file2 needs to be compared with std_file main counter=0... (1 Reply)
Discussion started by: Akshay Hegde
1 Replies

8. Shell Programming and Scripting

awk logic

I am trying to check my logic on a long awk i'm using. I have about 30 checks that I built into an awk and I "believe" I did this right, but I could be wrong. awk -F\| ' $9 !~ /\/*{1,}*/ $9 ~ /\(-{4}, {2,3}/ $9 ~ /\({6}, {2,3}\)/ $9 ~ /\(\+{5}, {2,3}\)/ $9 ~ /\(\+\+{4}, {2,3}\)/ $9 ~... (8 Replies)
Discussion started by: dagamier
8 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 11:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy