Counts and Evaluation by Substring

(imported topic written by MMarcus)

Hello–

Requesting assistance in developing the report code for the following situation:

I have a log file (see attached file) with three columns on each line: set#, True/False, filename

Sample:

“set01.0110.a”,“False”,“C:\temp\file.txt”

“set01.0110.b”,“True”,“C:\temp\file.txt”

The set# is comprised of “setdd.nnnn.a” where dd is a two-digit number, nnnn is a four-digit number, and a is a letter. (eg set01.0010, set01.0090, set01.0200)

I need to:

  1. For each collection of rows where setdd.nnnn is the same (.a varies), evaluate all the TRUE/FALSE values so that setdd.nnnn returns TRUE if ALL the values are TRUE and FALSE if ANY of the values are FALSE.

  2. Count the total number of sets, the number of sets which evaluate to TRUE, and the number that evaluate to FALSE.

  3. Display the filenames for each row which contains FALSE, where the set evaluates to FALSE. (This could be a separate report.)

Example:

Sets TrueSets FalseSets

20 16 (set01.0010, set.01.0030,…,set01.0200) 4 (set01.0090, set01.0110, set01.0150, set01.0160)

Many thanks for your time, insight, and assistance!

MMarcus

(imported comment written by liuhoting)

So I tried fiddling around for a little bit. I don’t think I’m quite where you want to be but maybe this can get you started…

The point I got to was basically to count all of the entries that had “false” or “true” in your set of data, and then to get the set01.0010 stuff. I figure after that you can just do some kind of sort or export it into some other program. I was basically playing around until I realized I only took into account condition 2 and condition 3 but not condition 1 (oops).

Here are some relevance queries:

Q: lines of file “C:\truefalsefile.txt”

A: “set01.0110.a”,“False”,“C:\temp\file.txt”

A: “set01.0110.b”,“True”,“C:\temp\file.txt”

A: “set01.0110.ac”,“False”,“C:\temp\file.txt”

A: “set01.0110.b”,“True”,“C:\temp\file.txt”

A: “set01.0110.ad”,“False”,“C:\temp\file.txt”

A: “set01.0110.be”,“True”,“C:\temp\file.txt”

A: “set01.0110.af”,“False”,“C:\temp\file.txt”

A: “set01.0110.bg”,“True”,“C:\temp\file.txt”

A: “set01.0110.ah”,“False”,“C:\temp\file.txt”

A: “set01.0110.ba”,“True”,“C:\temp\file.txt”

A: “set01.0110.ac”,“False”,“C:\temp\file.txt”

A: “set01.0110.beea”,“True”,“C:\temp\file.txt”

T: 0.605 ms

I: plural file line

Q: number of lines of file “C:\truefalsefile.txt”

A: 12

T: 0.579 ms

I: singular integer

Q: lines whose (it as string contains “False”) of file “C:\truefalsefile.txt”

A: “set01.0110.a”,“False”,“C:\temp\file.txt”

A: “set01.0110.ac”,“False”,“C:\temp\file.txt”

A: “set01.0110.ad”,“False”,“C:\temp\file.txt”

A: “set01.0110.af”,“False”,“C:\temp\file.txt”

A: “set01.0110.ah”,“False”,“C:\temp\file.txt”

A: “set01.0110.ac”,“False”,“C:\temp\file.txt”

T: 0.633 ms

I: plural file line

Q: preceding texts of firsts “,” of (lines whose (it as string contains “False”) of file “C:\truefalsefile.txt” as string)

A: “set01.0110.a”

A: “set01.0110.ac

A: “set01.0110.ad

A: “set01.0110.af

A: “set01.0110.ah”

A: “set01.0110.ac

T: 0.637 ms

I: plural substring