Searching text inside files – PowerShell

Searching text inside files – PowerShell

Today I will show you how to search for specified patterns in text files. We can say that it will be similar to known findstr in traditional cmd.

In PowerShell there is a command: Select-String

As a example file I will use text file with lorem ipsum content.

Example command which will find pattern will be like that:

We also can search in all files in specified location.

Take a look, that by default we see file name, line number and content but we can display additional params.

I choose most usable:

Also we can use param called -Exclude, where we can specify files we dont want to search.

Komentarze

Nie ma jeszcze komentarzy. Może zaczniesz dyskusję?

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *