My script finds a pattern and outputs all lines up to the pattern line into output.txt. But I get these added references in my output file when all I want is my original text.
readfile.txt:2:
readfile.txt:3:Original text in readfile.txt
readfile.txt:4:next line of text from readfile.txt
readfile.txt:5:blah blah
readfile.txt:6:down to pattern
readfile.txt:7:removed pattern line from the file below here
The relevant line in the script is:
# select the 6 lines before pattern 001 pattern
Select-String -Pattern '001' -Path readfile.txt -list -SimpleMatch -Context 6, 0 > output.txt
How do I get rid of the readfile.txt:2, readfile.txt:3, .. etc
references?
i have searched the docs and googled. Any suggestion appreciated.