get information out of large log-file

Welcome Forums General PowerShell Q&A get information out of large log-file

Viewing 2 reply threads
  • Author
    Posts
    • #265421
      Participant
      Topics: 2
      Replies: 4
      Points: 31
      Rank: Member

      Hello,

      as described in the title, i need some help getting some information from several log-files.
      These files are part of a testbench where all tests and many other information are stored.
      The format of these files is as following:

      2020-10-23 11:25:39:1000 [WARNING] some other stuff
      2020-10-23 11:25:39:1000 [WARNING] SerialNumber:123456
      2020-10-23 11:25:40:1000 [WARNING] some other stuff
      2020-10-23 11:25:40:1000 [WARNING] some other stuff
      2020-10-23 11:25:40:2000 [INFO] measurement started
      2020-10-23 11:25:41:3000 [INFO] measurement finished
      2020-10-23 11:25:41:1000 [WARNING] some other stuff
      2020-10-23 11:25:41:1000 [ERROR] and so on

      Searching for the string “measurement started” is simple… but i also need the serial number which is in one of the lines above.
      Unfortunately, the number of lines between Serial and measurement is not always the same…

      I have tried it using Add-Content/Get-Content; i tried it using loops… and nothing worked for me….

      Any ideas?

      Thanks in advance

    • #265430
      Participant
      Topics: 2
      Replies: 378
      Points: 503
      Helping Hand
      Rank: Major Contributor

      Output:

       

    • #265433
      Participant
      Topics: 2
      Replies: 4
      Points: 31
      Rank: Member

      wow… thank you very much… this works as expected 🙂

Viewing 2 reply threads
  • You must be logged in to reply to this topic.