Relevance Help - Remove the Zero's

Can anyone help me get rid of the rows that show 0 please? I’ve tried every version of this that I can think of but can’t work it out :frowning:

The 0’s are encapsulated by >0< in the file if that helps any?

    Q: (following text of last "<FSTotalSize>" of preceding text of last "</FSTotalS                                                                                                                                                             ize>" of it) of lines containing "FSTotalSize" of file "/var/opt/BESClient/LMT/C                                                                                                                                                             IT/detailed_hw_output.xml"
    A: 3983392
    A: 0
    A: 3995524
    A: 3995524
    A: 3995524
    A: 0
    A: 0
    A: 0
    A: 0
    A: 0
    A: 0
    A: 0
    A: 0
    A: 0
    A: 0
    A: 0
    A: 0
    A: 0
    A: 7350272
    A: 0
    A: 0
    A: 0
    A: 0
    A: 508580
    A: 2086912
    A: 1038336
    A: 4184064
    A: 508580
    A: 104323072
    A: 0

If you can then somehow get the numbers to sum as an integer then you get bonus points :smiley:

If you sum them, you don’t actually need to filter out the “0” strings but I think this snippet should illustrate how to do both

sum of (it as integer) of (following texts whose (it != "0") of last "<FSTotalSize>" ...

3 Likes

And the point goes to Mr @JasonWalker :grin:

3 Likes

I prefer to do the != 0 after it is already an integer because otherwise 00 could get passed through that filter.

sum of (it as integer) whose(it != 0) of (it as trimmed string) of following texts of

See here:

Q: (it as trimmed string) whose(it != "0") of ("0";"1";" 00  "; " 2 ")
A: 1
A: 00
A: 2
T: 0.091 ms
I: plural string

Using (it as trimmed string) is not a bad idea since (it as integer) won’t handle white space:

Q: (it as integer) of ("0";"1";" 00  "; " 2 ")
A: 0
A: 1
E: Singular expression refers to nonexistent object.

all together:

Q: (it as trimmed string as integer) whose(it != 0) of ("0";"1";" 00  "; " 2 ")
A: 1
A: 2
T: 0.196 ms
I: plural integer

and:

(it as trimmed string as integer) whose(it != 0) of following texts of lasts "<FSTotalSize>" of preceding texts of lasts "</FSTotalS                                                                                                                                                             ize>" of lines containing "FSTotalSize" of files "/var/opt/BESClient/LMT/C                                                                                                                                                             IT/detailed_hw_output.xml"

Also, you don’t need to exclude 0 when summing:

sums of (it as trimmed string as integer) of following texts of lasts "<FSTotalSize>" of preceding texts of lasts "</FSTotalS                                                                                                                                                             ize>" of lines containing "FSTotalSize" of files "/var/opt/BESClient/LMT/C                                                                                                                                                             IT/detailed_hw_output.xml"

I’m guessing this is related: Get Disk Space Used

2 Likes