Searched for this, and couldn\'t seem to find anyone who\'d already asked, so here goes.
I\'m starting to switch over to IPython as my go-to shell on Windows 7, and I\'d
The simplest way is to import os and update environment variable comspec
in your Jupiter notebook or python shell
import os
os.environ['comspec']='powershell.exe'
os.getenv('comspec')
Then use following command.
!gc log.txt | select -first 10 # head
!gc -TotalCount 10 log.txt # also head
!gc log.txt | select -last 10 # tail
!gc -Tail 10 log.txt # also tail (since PSv3), also much faster than above option
!gc log.txt | more # or less if you have it installed
!gc log.txt | %{ $_ -replace '\d+', '($0)' } # sed
and more at https://ss64.com/ps/