IF you have Windows PowerShell installed (I think it's included since XP) you can just run from cmd.exe:
Head Command:
powershell -command "& {Get-Content *filename* -TotalCount *n*}"
Tail Command:
powershell -command "& {Get-Content *filename* | Select-Object -last *n*}"
or, directly from PowerShell:
Get-Content *filename* -TotalCount *n*
Get-Content *filename* | Select-Object -last *n*
update
PowerShell 3.0 (Windows 8 and higher) added Tail
command with alias Last
.
Head
and First
aliases to TotalCount
were also added.
So, commands can be re-written as
Get-Content *filename* -Head *n*
Get-Content *filename* -Tail *n*
head
show only the first n lines instead of leaving them out? – Potmanhead
command, but the desired output looked like it was wantingtail
. It looks like the answers are abouthead
and nottail
. – Rosamariarosamondtail
, however the title saidhead
– Renee*[call to tail]* 2 > result.txt
, in which case it is equivalent totail
, or*[call to tail]* 1 > result.txt
, in which case it is not. – Wehrle