Outbreaker Posted August 13 Share Posted August 13 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? Link to comment Share on other sites More sharing options...
jaclaz Posted August 13 Share Posted August 13 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 Link to comment Share on other sites More sharing options...
Outbreaker Posted August 13 Author Share Posted August 13 (edited) 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 by Outbreaker Link to comment Share on other sites More sharing options...
jaclaz Posted August 13 Share Posted August 13 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 Link to comment Share on other sites More sharing options...
Outbreaker Posted August 16 Author Share Posted August 16 (edited) I now found the RegEx solution for it. JREPL.BAT "\[SourceNames\.x86\]" "$&\r\nTest-Line" /XSEQ /f "File.txt" /o - Edited August 16 by Outbreaker Link to comment Share on other sites More sharing options...
jaclaz Posted August 16 Share Posted August 16 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now