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 - Case-sensitive -replace command

Reply
 
Old 10-01-2007   #1 (permalink)
Gunilla


 
 

Case-sensitive -replace command

I am using the -replace command to replace tokens i some text files. However,
-replace seems to act upon tokens that I do not wish to have replaced. For
instance, the following command does not just replace the token 'Test', it
also replaces 'TEST'.

Get-Content file1.txt,file2.txt,file3.txt | % { $_ -replace 'Test', 'Test4' }

How can I tell the -replace command to replace tokens in a case-sensitive way?

My System SpecsSystem Spec
Old 10-01-2007   #2 (permalink)
Kiron


 
 

Re: Case-sensitive -replace command

-creplace Replace operator (case sensitive)

help about_operator

--
Kiron
My System SpecsSystem Spec
Old 10-01-2007   #3 (permalink)
Gunilla


 
 

Re: Case-sensitive -replace command

Thanks Kiron, the -creplace operator did the trick.

Thanks for pointing out the help topic about operators; I found a lot of
useful stuff there that I never knew existed...

"Kiron" wrote:
Quote:

> -creplace Replace operator (case sensitive)
>
> help about_operator
>
> --
> Kiron
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Problem with Case-Sensitive fieldnames .NET General
Case-sensitive Keys and Strings PowerShell
Re: replace method is case sensitive PowerShell
Filesystem Still Case Sensitive After Uninstalling SUA Vista General
Filesystem Still Case Sensitive After Uninstalling SUA Vista General


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