JREPL.BAT - how to replace with UK pound sign, using code page 850

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
davidblc
Posts: 1
Joined: 16 Jan 2022 08:48

JREPL.BAT - how to replace with UK pound sign, using code page 850

#1 Post by davidblc » 16 Jan 2022 09:10

How would I use JREPL.BAT to replace any occurrence of the text "zzz" (without the quotes) in a text file with the UK pound sign? I am using code page 850, Latin-1 (aka ISO-8859-1), for which the UK pound sign has number 163.

I looked for examples, but found nothing that seemed obvious to me.

Aacini
Expert
Posts: 1885
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: JREPL.BAT - how to replace with UK pound sign, using code page 850

#2 Post by Aacini » 16 Jan 2022 16:02

You don't need a program as complicated as JREPL to perform a replacement as simple as this one. Try this in a Batch .bat file:

Code: Select all

@set @a=0  /*
@cscript //nologo //E:JScript "%~F0" < input.txt > output.txt
@goto :EOF */


WScript.Stdout.Write(WScript.Stdin.ReadAll().replace(/zzz/g,String.fromCharCode(163)));
If the output file have not the right UK pound sign, try to hard-write it between quotes in place of String.fromCharCode(163).

For a further description on the replace method, see this page.

Antonio

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: JREPL.BAT - how to replace with UK pound sign, using code page 850

#3 Post by aGerman » 16 Jan 2022 16:50

Code: Select all

cmd /c ""JREPL.BAT" "zzz" "\xA3" /XSEQ /F "test.txt" /O -"
Steffen

Post Reply