August 13, 20233 yr Hi, Dose someone know how to find the first occurrence of [SourceNames.x86] in a text file and then add a new text line under it?
August 13, 20233 yr What has RegEx to do with this? You are looking for a very definite text, you can use gsar for this: http://tjaberg.com/ or FART: https://fart-it.sourceforge.net/ Otherwise you might want to try using SED (much more powerful but not as easy to use), a windows port is here: https://github.com/mbuilov/sed-windows A number of other tools/utilities do exist, but - generally speaking - they won't manage gracefully the CR+LF (the one after the [SourceNames.x86]). jaclaz
August 13, 20233 yr Author I have to use the "JREPL.bat" tool. All other tools have problems with different text encodings. This works: JREPL.BAT "[SourceNames.x86]" "[SourceNames.x86]\r\nNew-Line" /XSEQ /L /f "File.txt" /o - But i try to do something like this: JREPL.BAT "(RegEx)[SourceNames.x86]\r\n(RegEx)" "Test-Line" /XSEQ /L /f "File.txt" /o - Edited August 13, 20233 yr by Outbreaker
August 13, 20233 yr I do not understand your question, then, maybe it is a moving one. You seemingly asked a question about a problem that you already solved, both the question and the solution you found do not need the use of RegEx expression. Unfortunately I cannot follow you on the "I have to use" and "All other tools". If you have to use JREPL.BAT, it has a dedicated thread on another forum, ask your questions here: https://www.dostips.com/forum/viewtopic.php?t=6044 it is much more likely to find there people familiar with that tool. RegEx is already - by itself - complex enough, the ways each and every tool implements it may (or may not) be non-standard. TIme for a distraction: https://xkcd.com/1171/ jaclaz
August 16, 20233 yr Author I now found the RegEx solution for it. JREPL.BAT "\[SourceNames\.x86\]" "$&\r\nTest-Line" /XSEQ /f "File.txt" /o - Edited August 16, 20233 yr by Outbreaker
August 16, 20233 yr 25 minutes ago, Outbreaker said: I now found the RegEx solution for it. Though it doesn't seem at all like there is a RegEx expression anywhere in that. Anyway, the only important thing is that you are happy with your solution. jaclaz
Create an account or sign in to comment