Display first n lines, lines in middle or last n lines of a file with powershell.
Sometimes we need some specific content for a file, may be a version number , config details that lies in a specific file or config file.
We will be using the PowerShell cmdlets to achieve this.
Create a file with 10 lines with 1..10 and name it as file.txt
Now we use the cmdlet Get-content and get the required output using select.
Getting first 5 lines
Getting last 5 lines
Skipping first 3 lines and displaying rest..
Display some line in the middle say line 5,
This could be a useful approach to get the data fast across infrastructure with the help of PS remoting.
how to get the 5th row to 10th row
ReplyDeleteAwesome work, So I just want to share an online converter that will help you to convert one file into another like there;
ReplyDeleteSimple File Converter
That has support several formats like these;
ReplyDeleteMov to Flv
Mpg to Avi
Mxf to Mov
Mpg to Avi
Mid to Wav