count problem 
Author Message
 count problem

how can I count certain stringY repeated after certain numberN from stringX

My file looks like this :

StringX
fixed length of lines
..
..
StringY ( i may be found or not)
..
..
StringX
fixed length of lines
..
..
StringY ( i may be found or not)
..
..
StringX
fixed length of lines
..
..
StringY ( i may be found or not)

EOF

My goal to count StringY after this fixed length of lines .
How I do it .

Still I need to END of FILE indication



Mon, 14 Feb 2005 06:46:15 GMT  
 count problem
what have you tried?
should be a pretty straight forward programming exercise...
jen (show us your code) cross
Quote:

> how can I count certain stringY repeated after certain numberN from stringX

> My file looks like this :

> StringX
> fixed length of lines
> ..
> ..
> StringY ( i may be found or not)
> ..
> ..
> StringX
> fixed length of lines
> ..
> ..
> StringY ( i may be found or not)
> ..
> ..
> StringX
> fixed length of lines
> ..
> ..
> StringY ( i may be found or not)

> EOF

> My goal to count StringY after this fixed length of lines .
> How I do it .

> Still I need to END of FILE indication



Mon, 14 Feb 2005 10:21:00 GMT  
 count problem

Quote:
> how can I count certain stringY repeated after certain numberN from
stringX

> My file looks like this :

> StringX
> fixed length of lines
> ..
> ..
> StringY ( i may be found or not)
> ..
> ..
> StringX
> fixed length of lines
> ..
> ..
> StringY ( i may be found or not)
> ..
> ..
> StringX
> fixed length of lines
> ..
> ..
> StringY ( i may be found or not)

> EOF

> My goal to count StringY after this fixed length of lines .
> How I do it .

> Still I need to END of FILE indication

Very cryptic question...perhaps you could post some sample data (input,
output) if this is not what you need:

    BEGIN {fixedLengthOfLines = 5}
    /^StringX/ { yPos = NR + fixedLengthOfLines }
    /^StringY/ && (NR == yPos) { count++ }
    END {print count}

- Dan



Mon, 14 Feb 2005 12:09:14 GMT  
 count problem
I count certain stringY repeated after certain numberN from
Quote:
>  stringX

> > My file looks like this :

> > StringX
> > fixed length of lines
> > ..
> > ..
> > StringY ( i may be found or not)
> > ..
> > ..
> > StringX
> > fixed length of lines
> > ..
> > ..
> > StringY ( i may be found or not)
> > ..
> > ..
> > StringX
> > fixed length of lines
> > ..
> > ..
> > StringY ( i may be found or not)

> > EOF

> > My goal to count StringY after this fixed length of lines .
> > How I do it .

Input : file contain data as above .
Output : is No of StringY occurences which is existed only after fixed
no of lines from StringY .
Thanks for you help .


Wed, 02 Mar 2005 04:46:04 GMT  
 count problem

Quote:
> I count certain stringY repeated after certain numberN from
> >  stringX

> > > My file looks like this :

> > > StringX
> > > fixed length of lines
> > > ..
> > > ..
> > > StringY ( i may be found or not)
> > > ..
> > > ..
> > > StringX
> > > fixed length of lines
> > > ..
> > > ..
> > > StringY ( i may be found or not)
> > > ..
> > > ..
> > > StringX
> > > fixed length of lines
> > > ..
> > > ..
> > > StringY ( i may be found or not)

> > > EOF

> > > My goal to count StringY after this fixed length of lines .
> > > How I do it .
> Input : file contain data as above .
> Output : is No of StringY occurences which is existed only after fixed
> no of lines from StringY .
> Thanks for you help .

Did you try what I posted two weekes ago?  You did not tell me whatthe
results were, but you do seem to imply they were incorrect.

Change one charater in what I posted earlier.

    BEGIN {fixedLengthOfLines = 5}
    /^StringX/ { yPos = NR + fixedLengthOfLines }
    /^StringY/ && (NR >= yPos) { count++ }
    END {print count}

Quote:
> Input : file contain data as above .

No.  I am almost certain that your data DOES NOT contain the strings "fixed
length of lines" and "( i may be found or not)".  I asked you to post real
data two weeks ago in this thread, and tonight, in your most recent thread.
It is very hard to guess from your skeleton data what is real data and what
are instructions as to how I should guess the data to be.

    - Dan



Wed, 02 Mar 2005 13:05:32 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Newbie Hex Count Problem

2. counting problem

3. Reference count problem (Python -> C)

4. Count Down to DevCon -- 7 Days and Counting

5. count counter counting mechanism

6. counting events and miss first count

7. count counts but any doesnt

8. Count = Count + 1;

9. Cobol/DB2-problem processing COUNT(*)-results

10. GNAT-Problem '+'-operator with Count

11. DB2 + PHP select count visualization problem after insert

12. Debugging reference count errors; PIL problem

 

 
Powered by phpBB® Forum Software