Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 4.0 » Select-String

Select-String - Powershell 4.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Select-String

Short description
Finds text in strings and files.

Syntax


Description
The Select-String cmdlet searches for text and text patterns in input strings and files. You can use it like Grep in 
UNIX and Findstr in Windows. You can type "Select-String" or its alias, "sls".


Select-String is based on lines of text. By default, Select-String finds the first match in each line and, for each 
match, it displays the file name, line number, and all text in the line containing the match. However, you can direct 
it to detect multiple matches per line, display text before and after the match, or display only a Boolean value (true 
or false) that indicates whether a match is found.


Select-String uses regular expression matching, but it can also perform a simple match that searches the input for the 
text that you specify.


Select-String can display all of the text matches or stop after the first match in each input file. It can also 
display all text that does not match the specified pattern. You can also specify that Select-String should expect a 
particular character encoding, such as when you are searching files of Unicode text.