Add text to every line in text file using PowerShell
Posted
by
Joshua
on Stack Overflow
See other posts from Stack Overflow
or by Joshua
Published on 2011-02-10T01:33:51Z
Indexed on
2011/02/11
15:25 UTC
Read the original article
Hit count: 251
powershell
|powershell-v2.0
I'd like to add characters to the end of every line of text in a .txt document.
#Define Variables
$a = c:\foobar.txt
$b = get-content $a
#Define Functions
function append-text
{
foreach-Object
{
add "*"
}
}
#Process Code
$b | append-text
Something like that. Essentially, load a given text file, add a "*" the the end of every single line of text in that text file, save and close.
© Stack Overflow or respective owner