I have one file in which i want to search a text and then i need to find start and end block. Then need to copy to another file. I have multiple statements in the same file.
below is an example.
1: Start
2: hello
3: Hello world
4: Good Morning
5: End
I want to search "Good Morning" and then i want to copy text between start and end block to new file.
-Contextparameter ofSelect-String. that accepts one or two [int]s for "lines before, lines after". so-Context 3,1will grab the 3 lines before the matching line AND the 1 line after it. [grin] ///// take a look atGet-Help Select-String -Parameter Contextfor more info.