amitabhob wrote: ↑
08 Jun 2018 14:03
Thanks to you all, the Developer for this impressive utility, and everyone of you, for your constant help & and valuable inputs.
I am very novice in the scripting area, and came across this forum while trying to find a solution for one requirement I have. Advance thanks to you all for your time and any help.
I have a big 300-400mb file, with contents something similar to, what is shown below.
The need is:
To replace, Only the 1st 3 characters i.e "ABC" with "00XXXX00-" (excluding quotes), in every line, but, only when, the first 15 chars begin with ABC and ends with DEF.
If this pattern exists somewhere else in the same line, then, no replacement to be done on the other patterns found.
For example: sampleTest.txt file has below content:
Expected output of the new file resultFile.txt is:
Note: on 1st line, there were 2 matching patterns, but replacement is done only on the 1st pattern on that line.
I was able to construct the command upto this:
type "sampleTest.txt"|jrepl "ABC.........DEF" "00XXXX00-" /B > "resultFile.txt"
With this, I am able to limit search to 1st 15 chars, but, this command will also replace all 15 chars, not just the 1st 3 Chars ABC, which is what I want to fix.
If you can please help, with the right command. Thanks again.