Filtering Findstr results

Home Forums Scripting General Scripting Filtering Findstr results

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    chrispage
    Member
    #167424

    I am trying to extract the last word of a findstr results query

    The command I run
    findstr /i %1 x:itlogswho_when.txt | findstr /i %2[/CODE]
    the results I get
    [CODE]12/02/2018 10:17:58 SmithS Steve Smith B0K9VY1
    13/02/2018 09:29:13 SmithS Steve Smith B0K9VY1[/CODE]
    What i need from the results is that last word [I][B]B0K9VY1 [/B][/I]so i can run SCCM RemoteControl $computername

    (it will *always* be the last word on the last line of the results from my findstr query)[CODE]findstr /i %1 x:itlogswho_when.txt | findstr /i %2[/CODE]
    the results I get
    12/02/2018 10:17:58 SmithS Steve Smith B0K9VY1
    13/02/2018 09:29:13 SmithS Steve Smith B0K9VY1[/CODE]
    What i need from the results is that last word [I][B]B0K9VY1 [/B][/I]so i can run SCCM RemoteControl $computername

    (it will *always* be the last word on the last line of the results from my findstr query)[CODE]12/02/2018 10:17:58 SmithS Steve Smith B0K9VY1
    13/02/2018 09:29:13 SmithS Steve Smith B0K9VY1[/CODE]
    What i need from the results is that last word B0K9VY1 so i can run SCCM RemoteControl $computername

    (it will *always* be the last word on the last line of the results from my findstr query)

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.