locked
remove first 30 characters from get-content RRS feed

  • Question

  • hello

    i have a one liner which reads a file and filter it based on my criteria. the output is very lengthy. i need to remove the first 35 characters of that in order to have a clear result with no unwanted information

    Get-Content D:\netlogon.bak | Select-String -Pattern "CHI-*"

    after I filter based on pattern, i want to remove the first 35 charaters. how can i do this?

    thank you

    • Changed type MatCollins Sunday, April 26, 2015 11:47 AM
    Sunday, April 26, 2015 11:47 AM

Answers

  • Get-ContentD:\netlogon.bak | Select-String -Pattern "CHI-*" | %{$_.SubString(35,$_.Length-35)}

    \_(ツ)_/

    • Proposed as answer by Mike Laughlin Sunday, April 26, 2015 2:28 PM
    • Marked as answer by Boe ProxMVP Sunday, July 26, 2015 3:34 AM
    Sunday, April 26, 2015 12:36 PM