“tail -f” in Windows PowerShell

Takraw's Blog
Aug 27, 2021

--

how to get content like ‘tail -f’ on Linux in Windows Power Shell

Get content in file and filter by search_name

  • Linux
tail -f file_name | grep search_name
  • windows
Get-Content .\file_name -wait | Where {$_ -match "search_name"}

Get content 30 line in file and filter by search_name

  • Linux
tail -n30 -f file_name | grep search_name
  • windows
Get-Content .\file_name -wait -tail 30 | Where {$_ -match "search_name"}

Get Content in file and filter by search_name-1 and search_name-2

  • Linux
tail -f file_name | grep search_name-1 | grep search_name-2
  • windows
Get-Content .\file_name -wait | Where {$_ -match "search_name-1" -and $_ -match "search_name-2}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Takraw's Blog
Takraw's Blog

Written by Takraw's Blog

blog เก็บ scripts ,, ขอกาวป๋องดิ

No responses yet

Write a response