Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Select-String problem

Reply
 
Old 06-11-2007   #1 (permalink)
Keith Hill [MVP]


 
 

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



My System SpecsSystem Spec
Old 06-13-2007   #2 (permalink)
Neil Chambers


 
 

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

My System SpecsSystem Spec
Old 06-17-2007   #3 (permalink)
Keith Hill [MVP]


 
 

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

My System SpecsSystem Spec
Old 06-17-2007   #4 (permalink)
Keith Hill [MVP]


 
 

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

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Select-String -exclude PowerShell
select-string issue PowerShell
problems with $var | select-string -pattern $string -q PowerShell
Re: select-string exceptions PowerShell
Select-String problem with not English ASCII text PowerShell


Vista Forums 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 Ltd

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