Last active
March 6, 2017 12:40
-
-
Save tjukic/edaadcbc6e3115200d0d670a6bc3d8e2 to your computer and use it in GitHub Desktop.
Prepend line number to a file in PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$file = "pocetni.txt" | |
$t = (Get-Content $file) | |
$nt = New-Object System.Collections.ArrayList | |
for ($i=0;$i -lt $t.count; $i ++) { $nt += "[$($i + 1)]" + $t[$i] } | |
$nt | tee zavrsni.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment