Link to home
Start Free TrialLog in
Avatar of Europa MacDonald
Europa MacDonaldFlag for United Kingdom of Great Britain and Northern Ireland

asked on

counting rows in a list 4

I know very little about PERL :(

I have list of millions of rows of data. All data values are separated by a comma

I have to count how many rows contain a specific data value

for example

101,102,143,145,146,149
101,102,143,145,147,148
101,102,143,145,147,149
101,102,143,145,148,149
101,102,143,146,147,148
101,102,143,146,147,149
101,103,143,146,148,149
102,103,143,147,148,149
102,103,144,145,146,147
102,104,144,145,146,148
102,104,144,145,146,149
102,104,144,145,147,148

from that sample list, I have to count how many rows have the value 103 for the second data entry, but only if the value in the first column is 101, so for this list the number of rows with 103 in the second data entry where the first value is 101, would be 1

I have a previous script (attached) from "jb1dev + ozo" which counts the rows with particular values in the first and second column.

The problem that I have that this script is that it also includes any values in the second column that have 103 within them, for example, 1034, 1035 and so giving me an artificially high count.

I need this script to count only those rows with specifically 101, and 103 with no other combinations

Could you alter this script (as it works very fast) to count the number of rows with 103 in the second column only where the value 101 is in the first column ? and specifically ONLY those values I ask for ?

Thankyou very much in advance
count3a.txt
ASKER CERTIFIED SOLUTION
Avatar of jb1dev
jb1dev

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Europa MacDonald

ASKER

works great thankyou