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

Case-sensitive -replace command

Closed Thread
 
Thread Tools Display Modes
Old 10-01-2007   #1 (permalink)
Gunilla
Guest


 

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?
Old 10-01-2007   #2 (permalink)
Kiron
Guest


 

Re: Case-sensitive -replace command

-creplace Replace operator (case sensitive)

help about_operator

--
Kiron
Old 10-01-2007   #3 (permalink)
Gunilla
Guest


 

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
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: replace method is case sensitive Kiron PowerShell 0 07-16-2008 03:48 PM
sensitive touch pad paf Vista account administration 0 06-20-2008 05:21 PM
Context sensitive help in wpf application Atul Bahl Avalon 0 02-27-2007 11:48 AM
Filesystem Still Case Sensitive After Uninstalling SUA Michael J. Wheeler Vista General 3 02-16-2007 02:05 AM
Filesystem Still Case Sensitive After Uninstalling SUA Michael J. Wheeler Vista General 2 02-07-2007 11:09 AM








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