Skip to content

Instantly share code, notes, and snippets.

@ilkerde
Created February 24, 2012 10:18
Show Gist options
  • Save ilkerde/1899961 to your computer and use it in GitHub Desktop.
Save ilkerde/1899961 to your computer and use it in GitHub Desktop.
A very poor "grep" with PowerShell :-)
function pscan($s,$w) { ls * -i -r $w | %{$f=$_;$l=0;cat $f | %{$l++;$_;} | ?{$_ -imatch $s} | %{"[$l] $f: $_"}}}
@ilkerde
Copy link
Author

ilkerde commented Feb 24, 2012

Note: I know about select-string. That's just a small play. The "proper" way in posh would be like

ls * -i *.ps1 -r | sls "function" -a

Just to have that noted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment