Author Topic: Array Searching  (Read 1395 times)

seckner

  • Jr. Member
  • **
  • Posts: 70
Array Searching
« on: February 21, 2018, 01:44:56 pm »
Attached is a very small sample file from a Robocopy log. I'm using ArrayFileGet to load the attached file into an array. Now I want to search the attay and count how many times  "(0x00000005)" is found throughout the array and that should be 2. How do I search for a portion of the line? The only what I've gotten anything back is to ArraySearch or ArrayLocate the entire string:

ArrayLocate(array, "2018/02/21 15:05:37 ERROR 5 (0x00000005) Copying File \\Server\Shares\Person\misc\Toot my horn.pdf") finds the line but obviously wont find the second because the time changes.

The original file is 9000+ lines long and there will be around 100 or more of them so I'm hoping for something other than line by line if it can be done. Is it possible?
 

JTaylor

  • Pundit
  • *****
  • Posts: 1832
    • Data & Stuff Inc.
Re: Array Searching
« Reply #1 on: February 21, 2018, 02:01:52 pm »
Not sure the array approach is the best way.   Perhaps the Binary functions?

Jim

seckner

  • Jr. Member
  • **
  • Posts: 70
Re: Array Searching
« Reply #2 on: February 21, 2018, 06:00:09 pm »
Never used them before, guess it's time to learn! Thank you Jim.

JTaylor

  • Pundit
  • *****
  • Posts: 1832
    • Data & Stuff Inc.
Re: Array Searching
« Reply #3 on: February 21, 2018, 06:19:13 pm »
There is more than one way, as usual, but the BinaryTagInit() example would get you started and give you most everything you need.

Jim