Can TPIPE replacing Bytes like \0x00 ?

#1
I've tried to solve my tiny little problem with Mixed Unicode/Ansicode Textfiles,
so I can use a HEX-Editor (WinHEX) to remove the BOM-Header and all Zerobytes 0x00
to get a valid Ansi-File, then using TPIPE to convert it to Unicode.
I've also developed a BTM-Script to do the same, it was very funny and interesting :banhappy:
but as expected to slow, if the filesize is growing to megabyte sized.
But I have the feeling that TP should be able to do the same !
I've read up and down the help for TPIPE, but I'm not so familiar with GREP / RegEx / Perl Patterns.
So the Question is: Can I use TPIPE to search and replace single Bytes in a form like \0x00 ?
Thanks in advance :smile:
 
#3
The format "\xHH" works here, both in a search regex and in a replacement string. For example,
Code:
v:\> echo 222 | tpipe /replace=4,1,0,0,0,0,0,0,0,"\x32","\x33"
333
Many many thanks, Vince, this works !
This will do the job in3 seconds:
Code:
<Windows7>D:\JPSoft\BTMs :tpipe /input=UNICODEANSI.txt /output=$$$Ansi.txt /replace=4,1,0,0,0,0,0,0,0,"\x00","" /simple=62
<Windows7>D:\JPSoft\BTMs :tpipe /input=$$$Ansi.txt /output=$$$UNICODE.txt /simple=44 /string=1,0,\xFF\xFE
Before I've tried the /replace, but had not used the double quotes, because I did'nt know, that I have to use it !
As Bruce McKinney says it (in Hardcore Visual Basic 5 Second Edition) :
- EXAMPLES !!!!! DAMNED !
Thus, TPIPE remains a degree course ....:-P