Replace does not work

Hi,
I need to replace all characters between 1 and 31 (ASCII) for space in a file.
I created a script to test but it is not working (I tried two alternatives to replace).
$a = "Test$([char]26)Test$([char]27)Test"
$File_out = Join-Path $PSScriptRoot "teste.txt"
Remove-Item $File_out -ErrorAction SilentlyContinue
Add-Content -Path $File_out -Value $a
for($codAscii=1;$codAscii -le 31;$codAscii++){
$codAscii
$b = $a.Replace([char]$codAscii," ")
$c = $a -replace [char]$codAscii," "
Add-Content -Path $File_out -Value $b
Add-Content -Path $File_out -Value $c
Result:
What I need
Thanks in advance.
Fábio de Paula Junior

My workaround
function myReplaceAscii1_31([string]$Line,$NewChr){
for($codAscii=1;$codAscii -le 31;$codAscii++){
while($Line.Contains([char]$codAscii)){
$Pos = $Line.IndexOf([char]$codAscii)
$Line = $Line.Substring(0,$Pos) + $NewChr + $Line.Substring($Pos+1)
return $Line
$a = "Test$([char]26)Test$([char]27)Test"
$File_out = Join-Path $PSScriptRoot "teste.txt"
Remove-Item $File_out -ErrorAction SilentlyContinue
Add-Content -Path $File_out -Value $a
for($codAscii=1;$codAscii -le 31;$codAscii++){
$codAscii
$b = $a.Replace([char]$codAscii," ")
$c = $a -replace [char]$codAscii," "
$d = myReplaceAscii1_31 $a " "
Add-Content -Path $File_out -Value $b
Add-Content -Path $File_out -Value $c
Add-Content -Path $File_out -Value $d
Fábio de Paula Junior

Similar Messages

  • Text replacement does not work in Safari

    Text replacement does not work in Safari forms etc. Is it me or a bug?

    Interesting… I have eee set to auto-correct to an email address.
    if I type a few words and then add eee it works. But if I just enter eee in the email address of a form it does not.

  • 'Find and replace' does not work in 5.2.2!

    When I use 'find' in 5.2.2 it tells me e.g. that there are 9 occurrences of a particular item, but it will not allow me to navigate to them, either by using the return key, or by using the forward and back arrows or by using cmd + G. Has anyone else encountered this problem?

    Thank you for your reply. However, it doesn't solve my problem! I have a 42 page document of over 9000 words, including 6 pages of endnotes. If I place the cursor in the main part of the document and search for the text string 'Miguel de Cervantes', Find identifies 9 occurrences (all of which occur in the endnotes), but does not allow me to navigate to them, either using the forward/back arrows, or command + G or shift + command + G. If I place the cursor in the endnotes and search for the same text string Find allows me to navigate to the first occurrence of the text string but not to the remainder. I have experimented by searching for other words, and it seems that, while Find works ok for terms located in the main part of the document it does not allow you to navigate to results if the word or text string is in the Endnotes. This was never an issue in Pages 09. It does seem that there is a bug in the software here.

  • Color Replacement does not work

    I'm tyring to work through the tutorials. I've done the color replacement instructions over and over again just as the instructions seem to say which isn't very good, and nothing happens. Can anyone give a step by step instruction that works. The ones in the iPad tutorial for the MAC version is not working. I am working with version 14.XX on a Macbook Pro totally up to date.
    I watched a youtube video but is for an older version. Not much help as tools have been changed.

    Brainsprain wrote:
    I got it to work using a method from YouTube not from Adobe.
    So you didn't use Photoshop at all then?  That's a cool trick.

  • "Replace" does not work with drop zones?

    I set up a project in FCPX using "dummy" stock footage - edited drop zones, changed size/position of clips, etc...
    Now want to simply replace the stock footage with footage from the event browser.
    Dragging selections from the event browser to the timeline causes the replaced footage to appear full-screen - all editing work is lost.
    Is there another way to do this?

    When you drag over a clip in the timeline you are replacing that clip - which is precisely what you are getting, so no weird behavior here.
    How to do it properly depends on which generators you used, but you probably need to just replace the drop zone clips, which is done in the inspector. Select the title or generator and in the inspector select the appropriate drop zone and choose the clip you want.
    In the picture below I am using a split screen generator with two drop zones for left and right. The left drop zone is selected. 
    Once I click on a clip in the browser, it will appear; the choice is finalized by clicking the "Apply Clip" button.

  • Need to import bookmarks from another hard drives installation of FireFox into the new Firefox... Profiles folder replacing does not work.

    == Issue
    ==
    I have a problem with my bookmarks, cookies, history or settings
    == Description
    ==
    New install of new Firefox on different hard drive from old install, after copy/pasting profiles folder, bookmarks are still unavailable.
    '''Troubleshooting information'''
    french and German dictionaries
    == Firefox version
    ==
    3.5.10
    == Operating system
    ==
    Windows XP
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.10) Gecko/20100504 Firefox/3.5.10
    == Plugins installed
    ==
    *-Default Plug-in
    *NPRuntime Script Plug-in Library for Java(TM) Deploy
    *RealJukebox Netscape Plugin
    *RealPlayer(tm) LiveConnect-Enabled Plug-In
    *6.0.12.732
    *The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
    *Adobe Shockwave for Director Netscape plug-in, version 11.0
    *Adobe Acrobat Plug-In Version 7.00 for Netscape
    *Shockwave Flash 10.1 r53
    *DLM Netscape Plugin (2.3.10.115)
    *Java Plug-in 1.4.2_05 for Netscape Navigator (DLL Helper)
    *DRM Netscape Network Object
    *Npdsplay dll
    *DRM Store Netscape Plugin

    Have you seen this KB article?
    http://support.mozilla.com/en-US/kb/Recovering+important+data+from+an+old+profile

  • TS1381 My left arrow does not work on my macbook pro(model A1226).  I have reset nvram, performed a safe boot, pulled the cache to desktop, replaced .globalpreference.plist, test all other keys with keyboard view (all others work)  - HELP!!

    My left arrow does not work on my macbook pro(model A1226).
    I have reset nvram, performed a safe boot, pulled the cache to desktop, replaced .globalpreference.plist, & tested all other keys with "keyboard viewer" (all other keys work except for the arrow). 
    In addition, I have gone thru all the recommended checks with universal access and have booted from snow leopard dvd and the left arrow still does not work. 
    I have tried using the left arrow key in all of applications I use such as: excel, ms word, address book, calendar, iphoto, terminal, & highlighting an icon and using the arrows to move to another selected icon.
    Here is the kicker!  In addition, I purchased a logitech solar bluetooth keyboard and the arrows work fine with my ipad but do not work when paired with the macbook pro. All other keys work fine on the macbook pro using the bluetooth keyboard.
    I believe this says that the problem is not in my macbook pro keyboard. So where can it be?
    Can anyone think of any other rabbit holes I can search?
    thanks and regards
    vats3

    I would also like to add that I've reverted the two cd drive and hard drive mods I did and the laptop is back to factory hardware and there is 0 corrosion or mold visible.

  • My iphone 5 the volume bottom does not work  how to replace it in apple sotre

    My iphone 5 the volume bottom does not work  how to replace it in apple sotre
    i read sb said they only replace the iphone by pay more 210 quid is this ture ?

    Hi Austin XQ,
    Thanks for visiting Apple Support Communities.
    Based on the information you have provided, it sounds like your iPhone needs to be serviced. The following link should help you get started with the process and has links with additional information on topics such as warranty and service pricing, battery replacement, and express replacement service.
    http://support.apple.com/kb/index?page=servicefaq&geo=United_States&product=ipho ne
    Best,
    Jeremy

  • Just replaced iphone battery!! Please help!! Ear speaker does not work.

    I just replaced my iphone 3g battery. It seemed to go smooth. Everything works normally except the ear speaker doesnt work. When i try to make an outgoing call i cant here it ring, but my phone will actually call another phone. Does anyone know what # that connector is labeled as on the motherboard or back of the screen? Any help would be much appreciated!!!!!

    There may be a problem with the microswitch in the headset jack. Click on the following link for the Palm KB article regarding this issue.
    http://www.palm.com/cgi-bin/cso_kbURL.cgi?ID=40427
    If this procedure does not work then the phone will need to be replaced.
    For reference purposes, click on the following link for the support page for your device on the kb.palm.com webpage.
    http://kb.palm.com/wps/portal/kb/na/pre/p100eww/sprint/home/page_en.html
    There are links on the page to the user guide, troubleshooting, how to's, downloads, etc.

  • Serial Number does not work after hard drive was replaced

    My hard drive was replaced and now FCP 7 does not work even when I type in the correct serial number.  Help please. Thanks

    You posted your question in the Final Cut Pro X forum.
    You should repost it in the Final Cut Studio forum.

  • Using Acrobat Pro X on windows 7.  The replace pages feature does not work.  Is this a known issue? Is there a fix?

    Using Acrobat Pro X on windows 7.  The replace pages feature does not work.  Is this a known issue? Is there a fix?

    Hi Todd,
    I haven't heard other reports of this (though there was an issue quite some time ago where deleting pages on this combination of Acrobat/OS was challenging).
    Can you please tell me what happens when you try to replace pages? Do you get an error message? Are you able to manipulate pages otherwise (delete, extract, and so on)? Is this issue unique to one file, or does it happen with all PDF files?
    I look forward to hearing back from you.
    Best,
    Sara

  • My iphone5c is still under the 1 year warranty, the top button constantly sticks and does not work properly will Apple still replace my phone even though there is a few chips and scratches on the back?

    My iphone5c is still under the 1 year warranty, the top button constantly sticks and does not work properly will Apple still replace my phone even though there is a few chips and scratches on the back?

    As Peter says above, only an Apple Store genius can advise you.
    But to further clarify, you seem to postulate that if Apple helps you, the cure would be a replacement.  That is not necessarily true.  Let them look at it and advise you what the remedy is.  They may offer you nothing (saying it's your fault), or they may offer you a solution (keeping your current iPhone), or possibly a replacement.

  • My iphone4 power button does not work can i take it into apple store would they replace it with a new iphone or whats the deal?

    My iphone 4 power button does not work can i take it into apple store and replace it or what are some options

    Assuming it is out of warranty Apple Genius bar will exchange for an out-of -warranty  replacement unit identical to the to donor
    In US $149 for in iPhone 4

  • HT1202 The manual mode to transfer music to my iTune from my iPhone does not work as described. When I click on Manually manage... it displays the warning message that all music on my iPhone will be erased and replaced by iTune music.

    The manual mode to transfer music to my iTune from my iPhone does not work as described. When I click on Manually manage... it displays the warning message that all music on my iPhone will be erased and replaced by iTune music.
    How can I transfer my music to a second computer iTune?
    Thanks,

    See this user tip
    Syncing iPhone to a "New" Computer or replacing a "crashed" Hard Drive

  • My Bose SIE2i volume control does not work. (pause/play does work). This is the secone set - the apple store in Sydney replaced the firsat set that had the same problem. It was working OK and has stopped.

    My Bose SIE2i volume control does not work. (pause/play does work). This is the second set - the apple store in Sydney replaced the first set that had the same problem. It was working OK and has stopped.

    Thanks again V.K. I did check the layout, and it was listed as alphabet when I inputted the password. So that doesn't seems to the the issue.
    Just finished a truly mystifying experiment, but I put in a shorter password in the way mentioned earlier and it worked. I then systematically kept increasing the characters of that password and it seems that if the password starts to exceed about 16, it stops recognizing it. I am fairly sure it is not the password itself since it never gives an error when typing in the verification password. So unless I systematically make the exact mistake twice at the setup screen, and then don't or make a different mistake every time at the login screen, I don't think its my typing skill.
    So problem solved for now, but I am still a bit worried. Maybe I should completely reinstall and use a shorter password.
    Is there supposed to be a length limit?

Maybe you are looking for

  • CIN: How to check the material document posted without excise invoice

    Hi Guru, Please advise how to check the material document posted without excise invoice. I have tried tcode J1I7 but it seems start to collect the excise invoice first and then material document. But my case is to find the material document WITHOUT e

  • How to read parameter in WebService

    hello, i am new to webservices and i want to pass a parameter to my webservice. i declared a parameter "myname" in my wsdd file: <deployment xmlns="http://xml.apache.org/axis/wsdd/"     xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">   <

  • Freaky new User log-in option at start-up-arrgrhghghhh

    When I start-up (10.4...) I am presented with the log-in screen per my usual preference settings - I recently had to reset my passwords using the install cd to access the options for such a task (don't ask). Everything went as planned but when the co

  • "Function not authorized for License" error

    Hi All, I am getting "Function not authorized for License" error when i am retrieving details from a custom UI Map. The UI Map invokes a Business Service which calls a service program. I have written a page service for the service program. What Licen

  • Extension of BAPI's

    Baseline Information: -- We are running SAP ECC v6. -- We have added two new columns to the Equipment Master database, on the EQUI table.  These columns are entitled GUIDNO and Z_GISGRID.  These columns were added to the EQUI table within the SAP-del