Sponsored Content
Top Forums Shell Programming and Scripting need a logic to start with awk/ sh Post 302230878 by user_prady on Monday 1st of September 2008 12:23:10 AM
Old 09-01-2008
need a logic to start with awk/ sh

Hi Friends,

I got stuck where to start with ..

I ve a input file like below. where I want to compare write data with my read data .. The problem is that the read data should be compared with the lastest write data on that address.

Note- Both write data & read data are in the same file.
TXADDR & TXDATA means -write
RXADDR & RXDATA means - read

Code:
 120 : TXADDR  : 00000000

means at time 120 I am sending a TXADDR -00000000 & the data to be written are like below
Code:
     240 : TXDATA  0000000000000001
     280 : TXDATA  0000000000000002
     320 : TXDATA  0000000000000003
     360 : TXDATA  0000000000000004
     400 : TXDATA  0000000000000005

next when
Code:
 1042 : RXADDR  : 00000000

comes It the time to read from that address 00000000 returns me the data what is written before i.e, the last one..


INPUT FILE
Code:
     120 : TXADDR  : 00000000
     240 : TXDATA  0000000000000001
     280 : TXDATA  0000000000000002
     320 : TXDATA  0000000000000003
     360 : TXDATA  0000000000000004
     400 : TXDATA  0000000000000005
    1042 : RXADDR  : 00000000
    1080 : TXADDR  : 00000020
    1200 : TXDATA  0000000000000011
    1240 : TXDATA  0000000000000012
    1280 : TXDATA  0000000000000013
    1320 : TXDATA  0000000000000014
    1321 : RXDATA  0000000000000001
    1360 : TXDATA  0000000000000015
    1361 : RXDATA  0000000000000002
    1401 : RXDATA  0000000000000003
    1441 : RXDATA  0000000000000004
    1481 : RXDATA  0000000000000005
    1880 : TXADDR  : 00000040
    2000 : TXDATA  0000000000000021
    2040 : TXDATA  0000000000000022
    2080 : TXDATA  0000000000000023
    2120 : TXDATA  0000000000000024
    2120 : TXDATA  0000000000000025

If there is some confusion with my explanation pls comment .

Thanks &
Regards,
user_prady

Last edited by user_prady; 09-01-2008 at 01:28 AM..
 

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
SWFDISPLAYITEM.SETRATIO(3)						 1						SWFDISPLAYITEM.SETRATIO(3)

SWFDisplayItem::setRatio - Sets the object's ratio

SYNOPSIS
void SWFDisplayItem::setRatio (float $ratio) DESCRIPTION
Warning This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. swfdisplayitem.setratio(3) sets the object's ratio to $ratio. Obviously only useful for morphs. The object may be a swfshape(3), a swfbutton(3), a swftext(3) or a swfsprite(3) object. It must have been added using the swfmovie.add(3). RETURN VALUES
No value is returned. EXAMPLES
This simple example will morph nicely three concentric circles. Example #1 swfdisplayitem.setname(3) example <?php $p = new SWFMorph(); $g = new SWFGradient(); $g->addEntry(0.0, 0, 0, 0); $g->addEntry(0.16, 0xff, 0xff, 0xff); $g->addEntry(0.32, 0, 0, 0); $g->addEntry(0.48, 0xff, 0xff, 0xff); $g->addEntry(0.64, 0, 0, 0); $g->addEntry(0.80, 0xff, 0xff, 0xff); $g->addEntry(1.00, 0, 0, 0); $s = $p->getShape1(); $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT); $f->scaleTo(0.05); $s->setLeftFill($f); $s->movePenTo(-160, -120); $s->drawLine(320, 0); $s->drawLine(0, 240); $s->drawLine(-320, 0); $s->drawLine(0, -240); $g = new SWFGradient(); $g->addEntry(0.0, 0, 0, 0); $g->addEntry(0.16, 0xff, 0, 0); $g->addEntry(0.32, 0, 0, 0); $g->addEntry(0.48, 0, 0xff, 0); $g->addEntry(0.64, 0, 0, 0); $g->addEntry(0.80, 0, 0, 0xff); $g->addEntry(1.00, 0, 0, 0); $s = $p->getShape2(); $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT); $f->scaleTo(0.05); $f->skewXTo(1.0); $s->setLeftFill($f); $s->movePenTo(-160, -120); $s->drawLine(320, 0); $s->drawLine(0, 240); $s->drawLine(-320, 0); $s->drawLine(0, -240); $m = new SWFMovie(); $m->setDimension(320, 240); $i = $m->add($p); $i->moveTo(160, 120); for ($n=0; $n<=1.001; $n+=0.01) { $i->setRatio($n); $m->nextFrame(); } header('Content-type: application/x-shockwave-flash'); $m->output(); ?> PHP Documentation Group SWFDISPLAYITEM.SETRATIO(3)
All times are GMT -4. The time now is 11:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy