Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

get last line from string powershell

(gc "c:myfile.txt") | % -Begin {$test = (gc "c:myfile.txt" | select -first 1 -last 1)} -Process {if ( $_ -eq $test[0] -or $_ -eq $test[-1] ) { $_ -replace "-" } else { $_ }} | Set-Content "c:myfile.txt"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #line #string #powershell
ADD COMMENT
Topic
Name
9+5 =