jrepl new
Moderator: DosItHelp
jrepl new
Hi,
I'm trying to find and replace, in a txt file, this value: ,4, replace to ,2,
files contains line like this:
0001,4,0000000001,22,04/11/2016,01/01/0001 01:40:47,000035
i would like to check the part with ,4, anche change value to another number, ie ,1,.
jrepl " ¸4¸" " ¸1¸" /f test1.txt /o testnew.txt
any suggest?
thanks in advance.
I'm trying to find and replace, in a txt file, this value: ,4, replace to ,2,
files contains line like this:
0001,4,0000000001,22,04/11/2016,01/01/0001 01:40:47,000035
i would like to check the part with ,4, anche change value to another number, ie ,1,.
jrepl " ¸4¸" " ¸1¸" /f test1.txt /o testnew.txt
any suggest?
thanks in advance.
Re: jrepl new
This will replace any occurrence of ",4," ...
... while that would only replace occurrences of ",4," if the 4 is the second comma-separated token in a line.
Steffen
Code: Select all
cmd /c jrepl.bat ",4," ",1," /f "test1.txt" /o "testnew.txt"
Code: Select all
cmd /c jrepl.bat "([^,]*),4," "$1,1," /b /f "test1.txt" /o "testnew.txt"
Re: jrepl new
Thanks,
In my first test i wrote a command like the one you suggest:
cmd /c jrepl.bat ",4," ",1," /f "test1.txt" /o "testnew.txt"
but the result in txt file is something like this:
0001,1,0000000001,22,04/11/2016,01/01/0001 01:40:47,000035
ⰀⰀ Ⰰ㈀㈀Ⰰ 㐀⼀⼀㈀ 㘀Ⰰ ⼀ ⼀ 㔀㨀㌀㔀㨀㤀Ⰰ ㌀㌀ഀഀ
0001,1,0000000002,22,04/11/2016,01/01/0001 15:43:10,000033
ⰀⰀ ㌀Ⰰ㈀㈀Ⰰ 㐀⼀⼀㈀ 㘀Ⰰ ⼀ ⼀ 㔀㨀㐀㔀㨀㘀Ⰰ ㌀㔀ഀഀ
0001,1,0000000002,22,04/11/2016,01/01/0001 16:58:58,000033
ഀ
that's why i think is a comma problem and change the cl to the other one i wrote, without results.
cesare
In my first test i wrote a command like the one you suggest:
cmd /c jrepl.bat ",4," ",1," /f "test1.txt" /o "testnew.txt"
but the result in txt file is something like this:
0001,1,0000000001,22,04/11/2016,01/01/0001 01:40:47,000035
ⰀⰀ Ⰰ㈀㈀Ⰰ 㐀⼀⼀㈀ 㘀Ⰰ ⼀ ⼀ 㔀㨀㌀㔀㨀㤀Ⰰ ㌀㌀ഀഀ
0001,1,0000000002,22,04/11/2016,01/01/0001 15:43:10,000033
ⰀⰀ ㌀Ⰰ㈀㈀Ⰰ 㐀⼀⼀㈀ 㘀Ⰰ ⼀ ⼀ 㔀㨀㐀㔀㨀㘀Ⰰ ㌀㔀ഀഀ
0001,1,0000000002,22,04/11/2016,01/01/0001 16:58:58,000033
ഀ
that's why i think is a comma problem and change the cl to the other one i wrote, without results.
cesare
Re: jrepl new
Umm, no. That's rather an encoding problem of your file. Your output looks a little like UTF-16. Try to shorten the file to a few lines, put it into a ZIP archive and upload it here. Probably we are able to find the culprit if we see original data.
Steffen
Steffen
Re: jrepl new
Hi, i try with only two lines but nothing change.
in attach you can see starter file.
Thanks.
Cesare
in attach you can see starter file.
Thanks.
Cesare
- Attachments
-
- test1.zip
- (231 Bytes) Downloaded 322 times
Re: jrepl new
Exactly as I expected. The encoding is UTF-16 Little Endian with a Byte Order Mark.
Update your code like that:
Or for my second proposal above, respectively.
Steffen
Update your code like that:
Code: Select all
cmd /c jrepl.bat ",4," ",1," /f "test1.txt|UTF-16" /o "testnew.txt|UTF-16"
Steffen
Re: jrepl new
Steffen's suggestion of adding |UTF-16 to the file names uses ADO, which is fine.
Another option is to use the /UTF option to take advantage of CSCRIPT's native ability to read UTF-16. It should be marginally faster.
Dave Benham
Another option is to use the /UTF option to take advantage of CSCRIPT's native ability to read UTF-16. It should be marginally faster.
Code: Select all
cmd /c jrepl.bat ",4," ",1," /utf /f "test1.txt" /o "testnew.txt"
Dave Benham