How to get the Hello "Newline" and World in powershell using regex? -


how hello “newline” , world in powershell using regex?

hello world 

i have hello world text file. i'm using powershell.

this should work

$match = get-content -path <path_to_file> |      out-string |      select-string "hello`r`nworld"  if ( $match ) {     write-host $match.matches[0].groups[0].value } 

we load file get-content flatten array single string, in case piping out-string. finally, regex applied embedded crlf.

if have powershell 3, believe can use get-content -raw (which returns single string) , pipe straight select-string.

my test file:

line1 hello world line4 

output:

hello world 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -