PowerShell: Difference between revisions

Comparison with Linux commands
Tag: visualeditor
Line 31: Line 31:
|+
|+
!Action
!Action
!Linux
!PowerShell
!PowerShell
!Linux
|-
|-
|Search for a string
|Search for a string 1
|<nowiki>az keyvault list | findstr -i 'name":'</nowiki>
|<code><nowiki>az keyvault list | grep -i 'name";'</nowiki></code>
|<nowiki>az keyvualt list | grep -i 'name";'</nowiki>
|<code><nowiki>az keyvault list | findstr -i 'name":'</nowiki></code>
|-
|Search for a string 2 - current folder and subfolders
|<code><nowiki>find . | xargs grep -si "searchtext"</nowiki></code>
|<code><nowiki>Get-ChildItem -Path "." -Recurse -File | Select-String -Pattern "searchtext"</nowiki></code>
|-
|Search for a string 3 - only list names of files
|<code><nowiki>find . | xargs grep -sil "searchtext"</nowiki></code>
|<code><nowiki>Get-ChildItem -Path "." -Recurse -File | Select-String -Pattern "searchtext" -List | Select-Object -Property Path</nowiki></code>
|-
|-
|Alias a command
|Alias a command
|new-alias grep findstr
|<code>alias g grep</code>
|alias g grep
|<code>new-alias grep findstr</code>
|-
|
|
|
|}
|}