Skip to content

Instantly share code, notes, and snippets.

@scips
Created February 12, 2022 15:36
Show Gist options
  • Save scips/9f2153254746cf5de4278945e5fd57a7 to your computer and use it in GitHub Desktop.
Save scips/9f2153254746cf5de4278945e5fd57a7 to your computer and use it in GitHub Desktop.
Powershell cat tail head ...
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment