« Previous Next »

Thread: pulling out a string with SUBSTR()

Last post 12-29-2008 2:07 PM by ksingla. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 12-26-2008, 1:48 PM

    • daniel45
    • Not Ranked
    • Joined on 12-26-2008, 6:43 PM
    • Posts 1

    pulling out a string with SUBSTR()

    Hi

     

    I would like to pull a string out from a field of a variable length, where the length is defined by index_of("string2") - index_of("string1"), that is the field looks like this "some stuff string1 string string2"

     

    I've tried doing it like this SUBSTR(field, INDEX_OF('string1'), INDEX_OF('string2') - INDEX_OF('string1'))

    but logparser is refusing to accept this, and it is the "algebraic" part that is the problem.

     

    Does anyone have any ideas to solve this.

     

    Regards Daniel.

  • 12-29-2008, 2:07 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-13-2006, 11:02 PM
    • Redmond, WA
    • Posts 863

    Re: pulling out a string with SUBSTR()

    Shouldn't INDEX_OF('string1') be INDEX_OF(field, 'string1'). Also, you probably need to use SUB() to calculate difference of two values.

    Thanks,
    Kanwal

    Follow me on twitter at http://twitter.com/kjsingla
Page 1 of 1 (2 items)
Microsoft Communities