Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

grep -r equiv

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 05-14-2007   #1 (permalink)
Frank
Guest


 

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 SpecsSystem Spec
Old 05-14-2007   #2 (permalink)
Brandon Shell
Guest


 

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 SpecsSystem Spec
Old 05-14-2007   #3 (permalink)
Frank
Guest


 

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 SpecsSystem Spec
Old 05-14-2007   #4 (permalink)
Brandon Shell
Guest


 

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 SpecsSystem Spec
Old 05-15-2007   #5 (permalink)
Flowering Weeds
Guest


 

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 -statsff
Text
--------------------------------------------
ESC " -i:fs -recurse:0 -rtp:" -1" -statsff
-i:fs -recurse:0 -rtp:" -1" -statsff

Just another way!





My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and GREP swyck PowerShell 3 12-19-2007 02:45 PM
Grep Waz Vista file management 3 05-13-2007 10:23 PM
unix equiv wc -l and /dev/null Frank PowerShell 9 02-19-2007 11:10 AM
sfc /scannow or equiv in Vista? Peter Vista performance & maintenance 5 06-28-2006 07:09 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51