none
Find and extract part of string RRS feed

  • Question

  • Hi,

    Powershell 

    I got the following output in a string. 

    EXTRACT     RUNNING     E_RTCRS     00:00:00      00:00:00    
    EXTRACT     RUNNING     E_RTCRSB    00:00:00      00:00:01    
    EXTRACT     RUNNING     E_RTCRSG    00:00:00      00:00:09    
    EXTRACT     RUNNING     E_RTFST     00:00:00      00:00:01    
    EXTRACT     RUNNING     P_RTCRS     00:00:00      00:00:03    
    EXTRACT     RUNNING     P_RTCRSB    00:00:00      00:00:03    
    EXTRACT     RUNNING     P_RTCRSG    00:00:00      00:00:03    
    EXTRACT     RUNNING     P_RTFST     00:00:00      00:00:00  

    and I this part as an input to the script CRSG

    How do I easist find the entire string that im looking for - E_RTCRSG - in the output that I got ? 

    Cheers

    Monday, June 27, 2016 11:23 AM

Answers

All replies

  • Get-Content .\Test.txt | Select-String 'E_RTCRSG '

    Monday, June 27, 2016 11:37 AM
  • Thanks for your reply. But in this case the scrip only gets an input of CRSG and but need to find the full substring from the output - E_RTCRSG
    Monday, June 27, 2016 11:40 AM
  • Sorry i didn't understand ur question.
    Do u want to get the entire line which matches E_RTCRSG or CRGS
    Could u post the output u want



    Monday, June 27, 2016 11:55 AM
  • It is perfectly allright. 

    When I get the input of:

    CRSG

    Then I want to search the string

     EXTRACT     RUNNING     E_RTCRS     00:00:00      00:00:00    
    EXTRACT     RUNNING     E_RTCRSB    00:00:00      00:00:01    
    EXTRACT     RUNNING     E_RTCRSG    00:00:00      00:00:09    
    EXTRACT     RUNNING     E_RTFST     00:00:00      00:00:01    
    EXTRACT     RUNNING     P_RTCRS     00:00:00      00:00:03    
    EXTRACT     RUNNING     P_RTCRSB    00:00:00      00:00:03    
    EXTRACT     RUNNING     P_RTCRSG    00:00:00      00:00:03    
    EXTRACT     RUNNING     P_RTFST     00:00:00      00:00:00  

    and return the string: 

    E_RTCRSG

    Monday, June 27, 2016 12:16 PM
  • $Test = Get-Content .\Test.txt
    $Test -match 'crsg'
    $Matches[0]

    • Proposed as answer by Vincent Karunaidas Wednesday, July 6, 2016 10:09 AM
    • Marked as answer by agepeder Wednesday, August 24, 2016 12:37 PM
    Monday, June 27, 2016 12:35 PM