Windows Vista Forums
Vista Forums Home Join Vista Forums Donate 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

Select-String problem

Closed Thread
 
Thread Tools Display Modes
Old 06-11-2007   #1 (permalink)
Keith Hill [MVP]
Guest
 
Posts: n/a

Select-String problem

I'm bummed that Select-String is failing me here:

224# Select-String '^Test' '\\machine\c\Program
Files\Acme\Wino\Output\output1.txt'
Select-String : The file can not be read: \\machine\c\Program
Files\Acme\Wino\Output\output1.txt
At line:1 char:14
+ Select-String <<<< '^Test' '\\machine\c\Program
Files\Acme\Wino\Output\output1.txt'

But my trusty old MKS grep.exe works:

225# grep.exe -i '^Test' '\\machine\c\Program
Files\Acme\Wino\Output\output1.txt' | measure


Count : 184

Argh! That's just wrong! I want to get rid of MKS (eventually). So is the
problem related to the UNC path or the fact that the file is actively being
written to? I'm guessing it is the latter. Perhaps select-string is
opening the file in a naughty way?

--
Keith


 
Old 06-13-2007   #2 (permalink)
Neil Chambers
Guest
 
Posts: n/a

Re: Select-String problem

On 2007-06-12 01:58:55 +0100, "Keith Hill [MVP]"
<r_keith_hill@no.spam.thank.u.hotmail.com> said:

> I'm bummed that Select-String is failing me here:
>
> 224# Select-String '^Test' '\\machine\c\Program
> Files\Acme\Wino\Output\output1.txt'
> Select-String : The file can not be read: \\machine\c\Program
> Files\Acme\Wino\Output\output1.txt
> At line:1 char:14
> + Select-String <<<< '^Test' '\\machine\c\Program
> Files\Acme\Wino\Output\output1.txt'
>
> But my trusty old MKS grep.exe works:
>
> 225# grep.exe -i '^Test' '\\machine\c\Program
> Files\Acme\Wino\Output\output1.txt' | measure
>
>
> Count : 184
>
> Argh! That's just wrong! I want to get rid of MKS (eventually). So
> is the problem related to the UNC path or the fact that the file is
> actively being written to? I'm guessing it is the latter. Perhaps
> select-string is opening the file in a naughty way?


is the c share hidden? '\\machine\c$\pathtofile'

n

 
Old 06-17-2007   #3 (permalink)
Keith Hill [MVP]
Guest
 
Posts: n/a

Re: Select-String problem

"Neil Chambers" <n3llyb0y@aol.com> wrote in message
news:2007061320020243658-n3llyb0y@aolcom..."
>
> is the c share hidden? '\\machine\c$\pathtofile'
>


No there is a "C" share with read access. The MKS tail.exe utility can read
from that share just fine as can PowerShell.

--
Keith

 
Old 06-17-2007   #4 (permalink)
Keith Hill [MVP]
Guest
 
Posts: n/a

Re: Select-String problem

"Keith Hill [MVP]" <r_keith_hill@mailhot.nospamIdotcom> wrote in message
news:7EE7E726-6B96-46E2-8FED-44EC34ABDD03@microsoft.com...
> "Neil Chambers" <n3llyb0y@aol.com> wrote in message
> news:2007061320020243658-n3llyb0y@aolcom..."
>>
>> is the c share hidden? '\\machine\c$\pathtofile'
>>

>
> No there is a "C" share with read access. The MKS tail.exe utility can
> read from that share just fine as can PowerShell.


Oops, I meant the MKS grep.exe utility. Tailing files that PowerShell is
writing to is yet another issue.

--
Keith

 
 
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
problems with $var | select-string -pattern $string -q Ben Christian PowerShell 3 02-08-2008 12:41 PM
Re: select-string exceptions cmyers PowerShell 0 05-23-2007 02:10 PM
Re: select-string exceptions cmyers PowerShell 0 05-23-2007 02:09 PM
select-string to act like grep -v Frank PowerShell 5 05-12-2007 12:59 AM
Select-String problem with not English ASCII text Roman Kuzmin PowerShell 11 01-16-2007 08:34 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