Monday, 8 October 2012

Powershell - Get a Specific Line from a Text File

To retrieve the specific line of a text file in powershell use the following command:
Get-content -Path myfile.txt | Select-Object -Index 60614
To retrieve the first 10 rows use:
Get-content -Path myfile.txt | Select-Object -First 10
To retrieve the last10 rows use:
Get-content -Path myfile.txt | Select-Object -Last 10

No comments:

Post a Comment