Text Parsing and Multiplicity

(imported topic written by Steve73)

Hi

Some help if possible please.

This one is giving me a minor headache.

i have a file i need to check where i’m looking for the presence of “\” in each line and for each month (not day) that the line exists to run a count.

Maybe easier if I explain below:

number - 7/29/2011 - \name\name

number - 8/8/2011 - \name\name

number - 8/8/2011 - \name\name

number - 8/8/2011 - \name\name

number - 12/20/2011 - \name\name

…basically my results would ideally be:

Month, 7, Count, 1

Month, 8, Count, 3

Month, 12, Count, 1

I’ve gotten so far, but get the following results

Month, 7, Count, 1

Month, 8, Count, 1

Month, 8, Count, 1

Month, 8, Count, 1

Month, 12, Count, 1

Any ideas?

Cheers

(imported comment written by Lee Wei)

Here is one example:

q: ("Month", it, "Count", multiplicity of it) of unique values of preceding texts of firsts "/" of following texts of firsts "- " of lines whose (it contains "\\") of file "c:\temp\num.txt"
A: Month, 12, Count, 1
A: Month, 7, Count, 1
A: Month, 8, Count, 3

(imported comment written by Steve73)

Thanks Lee,

That works, although pulling it together in one is causing me a slight issue…sure I’m missing something obvious but the below gives me an “Incompatible Types” error:

if (exists file whose (name of it as string as lowercase contains “num.log”) of folder “C:\temp”) then (if (exists lines whose (it as string contains “\”) of file whose (name of it as string as lowercase contains “num.log”) of folder “C:\temp”) then ((“Month”, it, “Count”, multiplicity of it) of unique values of preceding texts of firsts “/” of following texts of firsts "- " of lines whose (it as string contains “\”) of file whose (name of it as string as lowercase contains “num.log”) of folder “C:\temp”) else “No Entries”) else “File Does Not Exist”

Any ideas where I’m going wrong?

Cheers

(imported comment written by Steve73)

Hi

Any ideas anyone?

This has me stumped!

Cheers

(imported comment written by cwmenard)

if (exists file whose (name of it as string as lowercase contains “num.log”) of folder “C:\temp”) then (if (exists lines whose (it as string contains “\”) of file whose (name of it as string as lowercase contains “num.log”) of folder “C:\temp”) then ((“Month”, it, “Count”, multiplicity of it) of unique values of preceding texts of firsts “/” of following texts of firsts "- " of lines whose (it as string contains “\”) of file whose (name of it as string as lowercase contains “num.log”) of folder “C:\temp” as string) else “No Entries”) else “File Does Not Exist”

That should fix you up.

(imported comment written by cwmenard)

It’s the

as string

. Guess BOLD doesn’t work?!? How do you edit a post on here?

(imported comment written by Steve73)

Perfect!

Thanks