Oct 03, 2020 · Step 1. Open PowerShell with elevated privileges. Step 2. Execute the following command, (change the file path) Add-Content c:\scripts\test.txt "The End". By default, the data is appended after the last character. If you want to append the data on a new line in the text document, use 'n.
Nov 10, 2014 · $ cat temp-file.txt 12345 12345 $ grep -o -b "3" temp-file.txt 2:3 8:3. Since grep treats text as “just” text, what you see above is the index of the match as grep reads the whole text in one chunk. Select-String treats text as most commands in PowerShell do, as an array of chars, and it also processes one line at the time.