Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Remove Last Element

$
0
0

Hi developer,

Get-Content .\test.txt| ForEach {
    $numberic = ($_ -split ' ')[-1].Trim()
    $numberic
    
}

aa aa aa 4
bb bb bb 3
cc cc cc 5
dd dd dd 1
ee ee ee 2

How to remove last element [3] (Numberic)?

Thanks



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>