none
Parser Log with Select-String RRS feed

  • Question

  • I'm trying to parse a file large MySQL log and I would need to export all SELECT and INSERT queries to another file, but in their correct position.

    I'll take this, but I put it in 2 files. Is it possible to configure the select-string with 2 values?

    $Output = select-string -path "d:\host_name.log" -pattern "Query select "
    $Output.line | out-file d:\outputfile.txt -append

    • Moved by Bill_Stewart Friday, July 7, 2017 6:55 PM Unanswerable help vampire question
    Monday, May 29, 2017 9:08 AM

All replies

  • Start by reading the complete help for the CmdLet:

    select-string -path d:\host_name.log -pattern Query,select | out-file d:\outputfile.txt


    \_(ツ)_/

    Monday, May 29, 2017 9:16 AM
  • The problem is that if I have select on line 3 and 6 and 2 updates on line 4.5, I do not show them in order.

    Solution: -patttern "String1","String2"

    JRV, in the select-string you can say that only show "select" in lowercase?

    Solution with: –caseSensitive

    One last thing jrv, how can I delete all the lines, all words and spaces to the left of "query"?


    Monday, May 29, 2017 9:23 AM