Page 1 of 1
JREPL.BAT - how to replace with UK pound sign, using code page 850
Posted: 16 Jan 2022 09:10
by davidblc
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.
Re: JREPL.BAT - how to replace with UK pound sign, using code page 850
Posted: 16 Jan 2022 16:02
by Aacini
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
Re: JREPL.BAT - how to replace with UK pound sign, using code page 850
Posted: 16 Jan 2022 16:50
by aGerman
Code: Select all
cmd /c ""JREPL.BAT" "zzz" "\xA3" /XSEQ /F "test.txt" /O -"
Steffen