diff --git a/reference/5.1/Microsoft.PowerShell.Utility/Select-String.md b/reference/5.1/Microsoft.PowerShell.Utility/Select-String.md index 69379f49b1a..8dd20bd4a13 100644 --- a/reference/5.1/Microsoft.PowerShell.Utility/Select-String.md +++ b/reference/5.1/Microsoft.PowerShell.Utility/Select-String.md @@ -19,24 +19,24 @@ Finds text in strings and files. ### File (Default) ``` -Select-String [-Pattern] [-Path] [-SimpleMatch] [-CaseSensitive] [-Quiet] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] [-Encoding ] +Select-String [-Pattern] [-Path] [-SimpleMatch] [-CaseSensitive] [-Quiet] + [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] [-Encoding ] [-Context ] [] ``` ### Object ``` -Select-String [-Pattern] -InputObject [-SimpleMatch] [-CaseSensitive] [-Quiet] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] [-Encoding ] +Select-String -InputObject [-Pattern] [-SimpleMatch] [-CaseSensitive] [-Quiet] + [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] [-Encoding ] [-Context ] [] ``` ### LiteralFile ``` -Select-String [-Pattern] -LiteralPath [-SimpleMatch] [-CaseSensitive] [-Quiet] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] [-Encoding ] +Select-String [-Pattern] -LiteralPath [-SimpleMatch] [-CaseSensitive] [-Quiet] + [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] [-Encoding ] [-Context ] [] ``` @@ -469,7 +469,7 @@ Accept wildcard characters: False ### -List Only the first instance of matching text is returned from each input file. This is the most -efficient way to retrieve a list files that have contents matching the regular expression. +efficient way to retrieve a list of files that have contents matching the regular expression. By default, `Select-String` returns a **MatchInfo** object for each match it finds. @@ -633,8 +633,9 @@ parameter. To specify the text to be searched, use the following criteria: - If the text is stored in files, use the **Path** parameter to specify the path to the files. By default, `Select-String` interprets the value of the **Pattern** parameter as a regular -expression. (For more information, see [about_Regular_Expressions](../Microsoft.PowerShell.Core/About/about_Regular_Expressions.md). -You can use the **SimpleMatch** parameter to override the regular expression matching. The +expression. For more information, see +[about_Regular_Expressions](../Microsoft.PowerShell.Core/About/about_Regular_Expressions.md). You +can use the **SimpleMatch** parameter to override the regular expression matching. The **SimpleMatch** parameter finds instances of the value of the **Pattern** parameter in the input. The default output of `Select-String` is a **MatchInfo** object, which includes detailed information @@ -647,7 +648,7 @@ If you don't need the information in the **MatchInfo** object, use the **Quiet** instead of a **MatchInfo** object. When matching phrases, `Select-String` uses the current culture that is set for the system. To find -the current culture, use the Get-Culture cmdlet. +the current culture, use the `Get-Culture` cmdlet. To find the properties of a **MatchInfo** object, type the following command: diff --git a/reference/6/Microsoft.PowerShell.Utility/Select-String.md b/reference/6/Microsoft.PowerShell.Utility/Select-String.md index d89bb9d450b..378881fdfff 100644 --- a/reference/6/Microsoft.PowerShell.Utility/Select-String.md +++ b/reference/6/Microsoft.PowerShell.Utility/Select-String.md @@ -19,24 +19,24 @@ Finds text in strings and files. ### File (Default) ``` -Select-String [-Pattern] [-Path] [-SimpleMatch] [-CaseSensitive] [-Quiet] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] +Select-String [-Pattern] [-Path] [-SimpleMatch] [-CaseSensitive] [-Quiet] + [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] [-Encoding ] [-Context ] [] ``` ### Object ``` -Select-String [-Pattern] -InputObject [-SimpleMatch] [-CaseSensitive] [-Quiet] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] +Select-String -InputObject [-Pattern] [-SimpleMatch] [-CaseSensitive] [-Quiet] + [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] [-Encoding ] [-Context ] [] ``` ### LiteralFile ``` -Select-String [-Pattern] -LiteralPath [-SimpleMatch] [-CaseSensitive] [-Quiet] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] +Select-String [-Pattern] -LiteralPath [-SimpleMatch] [-CaseSensitive] [-Quiet] + [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] [-Encoding ] [-Context ] [] ``` @@ -476,7 +476,7 @@ Accept wildcard characters: False ### -List Only the first instance of matching text is returned from each input file. This is the most -efficient way to retrieve a list files that have contents matching the regular expression. +efficient way to retrieve a list of files that have contents matching the regular expression. By default, `Select-String` returns a **MatchInfo** object for each match it finds. @@ -640,8 +640,9 @@ parameter. To specify the text to be searched, use the following criteria: - If the text is stored in files, use the **Path** parameter to specify the path to the files. By default, `Select-String` interprets the value of the **Pattern** parameter as a regular -expression. (For more information, see [about_Regular_Expressions](../Microsoft.PowerShell.Core/About/about_Regular_Expressions.md). -You can use the **SimpleMatch** parameter to override the regular expression matching. The +expression. For more information, see +[about_Regular_Expressions](../Microsoft.PowerShell.Core/About/about_Regular_Expressions.md). You +can use the **SimpleMatch** parameter to override the regular expression matching. The **SimpleMatch** parameter finds instances of the value of the **Pattern** parameter in the input. The default output of `Select-String` is a **MatchInfo** object, which includes detailed information @@ -654,7 +655,7 @@ If you don't need the information in the **MatchInfo** object, use the **Quiet** instead of a **MatchInfo** object. When matching phrases, `Select-String` uses the current culture that is set for the system. To find -the current culture, use the Get-Culture cmdlet. +the current culture, use the `Get-Culture` cmdlet. To find the properties of a **MatchInfo** object, type the following command: diff --git a/reference/7/Microsoft.PowerShell.Utility/Select-String.md b/reference/7/Microsoft.PowerShell.Utility/Select-String.md index 8be1a7a95cd..f7d9fbd72c4 100644 --- a/reference/7/Microsoft.PowerShell.Utility/Select-String.md +++ b/reference/7/Microsoft.PowerShell.Utility/Select-String.md @@ -20,48 +20,48 @@ Finds text in strings and files. ``` Select-String [-Pattern] [-Path] [-SimpleMatch] [-CaseSensitive] [-Quiet] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] - [-Encoding ] [-Context ] [] + [-List] [-NoEmphasis] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] + [-Encoding ] [-Context ] [] ``` ### ObjectRaw ``` Select-String -InputObject [-Pattern] -Raw [-SimpleMatch] [-CaseSensitive] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] - [-Encoding ] [-Context ] [] + [-List] [-NoEmphasis] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] + [-Encoding ] [-Context ] [] ``` ### Object ``` Select-String -InputObject [-Pattern] [-SimpleMatch] [-CaseSensitive] [-Quiet] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] - [-Encoding ] [-Context ] [] + [-List] [-NoEmphasis] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] + [-Encoding ] [-Context ] [] ``` ### FileRaw ``` Select-String [-Pattern] [-Path] -Raw [-SimpleMatch] [-CaseSensitive] [-List] - [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] [-Encoding ] - [-Context ] [] + [-NoEmphasis] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] + [-Encoding ] [-Context ] [] ``` -### LiteralFileRaw +### LiteralFile ``` -Select-String [-Pattern] -LiteralPath -Raw [-SimpleMatch] [-CaseSensitive] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] - [-Encoding ] [-Context ] [] +Select-String [-Pattern] -LiteralPath [-SimpleMatch] [-CaseSensitive] [-Quiet] + [-List] [-NoEmphasis] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] + [-Encoding ] [-Context ] [] ``` -### LiteralFile +### LiteralFileRaw ``` -Select-String [-Pattern] -LiteralPath [-SimpleMatch] [-CaseSensitive] [-Quiet] - [-List] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] - [-Encoding ] [-Context ] [] +Select-String [-Pattern] -LiteralPath -Raw [-SimpleMatch] [-CaseSensitive] + [-List] [-NoEmphasis] [-Include ] [-Exclude ] [-NotMatch] [-AllMatches] + [-Encoding ] [-Context ] [] ``` ## DESCRIPTION @@ -500,7 +500,7 @@ Accept wildcard characters: False ### -List Only the first instance of matching text is returned from each input file. This is the most -efficient way to retrieve a list files that have contents matching the regular expression. +efficient way to retrieve a list of files that have contents matching the regular expression. By default, `Select-String` returns a **MatchInfo** object for each match it finds. @@ -535,6 +535,29 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -NoEmphasis + +By default, `Select-String` highlights the string that matches the pattern you searched for with the +**Pattern** parameter. The **NoEmphasis** parameter disables the highlighting. + +The emphasis uses negative colors based on your PowerShell background and text colors. For example, +if your PowerShell colors are a black background with white text. The emphasis is a white background +with black text. + +This parameter was introduced in PowerShell 7. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -NotMatch The **NotMatch** parameter finds text that doesn't match the specified pattern. @@ -610,9 +633,11 @@ Accept wildcard characters: False ### -Raw Causes the cmdlet to output only the matching strings, rather than **MatchInfo** objects. This is -the results in behavior that is the most similar to the Unix **grep** or Windows **findstr.exe** +the results in behavior that's the most similar to the Unix **grep** or Windows **findstr.exe** commands. +This parameter was introduced in PowerShell 7. + ```yaml Type: SwitchParameter Parameter Sets: ObjectRaw, FileRaw, LiteralFileRaw @@ -683,8 +708,9 @@ parameter. To specify the text to be searched, use the following criteria: - If the text is stored in files, use the **Path** parameter to specify the path to the files. By default, `Select-String` interprets the value of the **Pattern** parameter as a regular -expression. (For more information, see [about_Regular_Expressions](../Microsoft.PowerShell.Core/About/about_Regular_Expressions.md). -You can use the **SimpleMatch** parameter to override the regular expression matching. The +expression. For more information, see +[about_Regular_Expressions](../Microsoft.PowerShell.Core/About/about_Regular_Expressions.md). You +can use the **SimpleMatch** parameter to override the regular expression matching. The **SimpleMatch** parameter finds instances of the value of the **Pattern** parameter in the input. The default output of `Select-String` is a **MatchInfo** object, which includes detailed information @@ -697,7 +723,7 @@ If you don't need the information in the **MatchInfo** object, use the **Quiet** instead of a **MatchInfo** object. When matching phrases, `Select-String` uses the current culture that is set for the system. To find -the current culture, use the Get-Culture cmdlet. +the current culture, use the `Get-Culture` cmdlet. To find the properties of a **MatchInfo** object, type the following command: