in reply to Re: Faster way?
in thread Faster way?

Actually I want it matching the search value regardless of how (where) it comes up in the line :-).
There is a lot more that the prog does, it's not for MY value, this is for a bunch of people that have never used grep. Plus we are using win2k here, this app is faster than the "find" command. One of those issues of people using an app for a while that don't want to see it go. We used to use scripts on DEC/VMS to do this :-)

Replies are listed 'Best First'.
RE: RE: Re: Faster way?
by Fastolfe (Vicar) on Oct 06, 2000 at 22:27 UTC
    /$search_pattern/ is unanchored:
    "abcdefg" =~ /cd/ # true "abcdefg" =~ /^cd/ # anchored at start, false "abcdefg" =~ /fg$/ # anchored at end, true
    The regular expression I provided will match anywhere in the line, unless you've modified that behavior by inserting a ^ or $ at the beginning of the search string, or the end, respectively.
      Thanks for that :-)
      The code from above seems to not do much for speed improvement though, obviously cleaner, but not much faster. Damned w2k.. all of these are out on a file server for shared access. I run this same code on my linux box, and way way faster. Too bad :(
        Moving your open and close calls outside of your loop will definitely speed things up. Check the comments in my original post for other speed-ups.