Replace every URL with the URL + text
-
I’m using Notepad++ and I can’t figure this out :
I have a database of host and ports that looks like this :
http://192.168.1.1:123 http://18.81.1.25:12
And I have another database that I need to replace this text with
http://host:port/123 http://host:port/124 http://host:port/125 http://host:port/126
So that the result would be like this :
http://192.168.1.1:123/123 http://192.168.1.1:123/124 http://192.168.1.1:123/125 http://192.168.1.1:123/126 http://18.81.1.25:12/123 http://18.81.1.25:12/124 http://18.81.1.25:12/125 http://18.81.1.25:12/126
So on and so forth
Thanks :)
-
@شعر-Tech said in Replace every URL with the URL + text:
I can’t figure this out :
What did you try? Generally, it’s considered polite to include what you’ve already tried when asking such a question. That way, people can point you to the error of your ways (and get an idea of your current skill-level, so that the answer might be more understandable.)
However, looking at your requirements: in general, wanting to do something with every line of group A combined with every line of group B is a Cartesian Product, and you will need general programming techniques. You might want to follow my advice for a similar (but not necessarily identical) Cartesian Product from last summer – start with that; if it’s not exactly what you want, try reading the PythonScript help files to modify it to accomplish what you do want; if you get stuck and have a specific problem, show us what you’ve tried, what it gives you, and what you were hoping for.
-
I’m sorry I have only tried manually replacing the URL and I have no programming knowledge.
Thanks a lot for yourhelp, I thought a plugin was already available that does that sort of thing but in retrospect you’re right I absolutely need programming. -
@شعر-Tech I might be able to make a simple C# program that does this. In the second chunk that starts with http://host:port/123, does the integer 123 always come after a slash?
Or is there a case like this: http://host:port/123/456 where there is slash embedded in the number, you would want to copy 123/456 or just 456?
-
@jcg3675 Yes the integer always comes after the slash and no there’s no case like this : http://host:port/123/456
Thanks a lot for your help :)
-
So I made a simple app, I call it HostPort, you can download it from the Microsoft Store here.
Your PC needs to be running Windows 10, version 1903 or later. If you are using an earlier release of Windows 10, I can recompile it and update it pretty easily. Just tell me what version (you can find it in Settings > System > About). If you are using an older edition of Windows, like Windows 8 or Windows 7, it might take a little bit of time for me to port it–I do not usually work with 7 or 8. But I can try!
If the program does not work as intended, let me know and I will make modifications as needed and update it.
-
@jcg3675 It works perfectly just as intended !
I don’t know how I can thank you so if you need anything just ask :) -
Glad to hear that it works! You don’t owe me anything. Just pay it forward to someone else when the time comes :)