0

I am new to PowerShell. I'd like to add double quotation and OR, e.g.,"word" OR, for each line in a text file and output the results in a new file. I got this so far: %{" "$_ " OR "} but of course it's giving me the following error: Unexpected token.

0

1 Answer 1

2

Nested double quotes must be escaped (escape character in PowerShell is the backtick):

% { "`"$_`" OR" }
Sign up to request clarification or add additional context in comments.

5 Comments

Thank you. Now how do you get rid of the white space at the end of each line?.
Trim it.
The actual file has white space at the end of each string, how do you get ride of it using PowerShell?. Thanks in advance.
I already told you. For further advice please post a new question. Make sure you include sample input and output.
I got it! Thanks again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.