![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | grep -r equiv Hi, What is the preferred method to doing the equivalent of "grep -r". I tried: get-childitem *.ps1 | get-content | select-string "somestring" but it seems to only get the top level .ps1 sripts. thanks in advance, |
My System Specs![]() |
| | #2 (permalink) |
| | Re: grep -r equiv this should work. This will list every file and add the lines if found.. you can change that of course. get-childitem *.ps1 -recurse | %{get-content $_.FullName;Write-Host $_.FullName} | select-string "somestring" "Frank" <Frank@discussions.microsoft.com> wrote in message news:EA70370B-B79A-4015-A77D-A80DEE37319B@microsoft.com... > Hi, > > What is the preferred method to doing the equivalent of "grep -r". I > tried: > > get-childitem *.ps1 | get-content | select-string "somestring" but it > seems > to only get the top level .ps1 sripts. > > thanks in advance, > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: grep -r equiv That does not appear to work. I purposely put subdirs there and I had to do: get-childitem *\*.ps1 -recurse to find them. What gives? "Brandon Shell" wrote: > this should work. This will list every file and add the lines if found.. you > can change that of course. > > get-childitem *.ps1 -recurse | %{get-content $_.FullName;Write-Host > $_.FullName} | select-string "somestring" > > "Frank" <Frank@discussions.microsoft.com> wrote in message > news:EA70370B-B79A-4015-A77D-A80DEE37319B@microsoft.com... > > Hi, > > > > What is the preferred method to doing the equivalent of "grep -r". I > > tried: > > > > get-childitem *.ps1 | get-content | select-string "somestring" but it > > seems > > to only get the top level .ps1 sripts. > > > > thanks in advance, > > > > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: grep -r equiv get-childitem requires path (at least as far as I can tell) for recursion. What I did was: get-childitem $mypath *.ps1 -recurse "Frank" <Frank@discussions.microsoft.com> wrote in message news:0AC67253-E72D-492B-8DD3-57D411F3F50E@microsoft.com... > That does not appear to work. I purposely put subdirs there and I had to > do: > > get-childitem *\*.ps1 -recurse > > to find them. What gives? > > > > "Brandon Shell" wrote: > >> this should work. This will list every file and add the lines if found.. >> you >> can change that of course. >> >> get-childitem *.ps1 -recurse | %{get-content $_.FullName;Write-Host >> $_.FullName} | select-string "somestring" >> >> "Frank" <Frank@discussions.microsoft.com> wrote in message >> news:EA70370B-B79A-4015-A77D-A80DEE37319B@microsoft.com... >> > Hi, >> > >> > What is the preferred method to doing the equivalent of "grep -r". I >> > tried: >> > >> > get-childitem *.ps1 | get-content | select-string "somestring" but it >> > seems >> > to only get the top level .ps1 sripts. >> > >> > thanks in advance, >> > >> > >> >> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: grep -r equiv "Frank" > > What is the preferred method Preferred? ![]() > to doing the equivalent of "grep -r". > Well since grep is a process then perhaps doing the same is running another process too! ![]() PS> LogParser -h -i:textline | select-string "recurse" -recurse <level> : Max subdirectory recursion level (0=no recurse, -1=all levels) PS> LogParser "SELECT Text FROM '$pwd\*' WHERE Text LIKE '%recurse%' " -i:textline -recurse:" -1" -rtp:5 -stats ffText -------------------------------------------- ESC " -i:fs -recurse:0 -rtp:" -1" -stats ff-i:fs -recurse:0 -rtp:" -1" -stats ffJust another way! |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Find and GREP | PowerShell | |||
| Grep | Vista file management | |||
| select-string to act like grep -v | PowerShell | |||
| sfc /scannow or equiv in Vista? | Vista performance & maintenance | |||