replacing a specific text from a another file
-
@Alan-Kilborn said in replacing a specific text from a another file:
skill set
Hmmm… If there’s no skills
-
@fenzek1 said in replacing a specific text from a another file:
If there’s no skills
… then one should invest the time to gain those skills. If you are not willing to invest the time, then we cannot help you.
The simple answer to your question is “Notepad++ cannot do this task without effort on your part”.
The more complicated answer is that it’s really a programming task. Notepad++ doesn’t natively allow you to “program” your replacement, so it cannot natively do the task you have requested. However, there are plugins, like the PythonScript plugin, which do allow you to write code to manipulate data inside Notepad++; or if you know how to code or have someone you can pay to code for you, a standalone program could easily be written in that coder’s language of choice.
If you are willing to install and use the PythonScript plugin, and are willing to learn, then we might be able to help you customize the script mentioned in the “massive search and replace” discussion that Alan linked you to. But as it currently stands, you seem unwilling to install a plugin or try to learn… and we cannot help you any further if you are unwilling to do both of those.
So again, the short answer: “without effort and learning on your part, Notepad++ cannot accomplish the task you have outlined.” (The same will be true of any text editor I’ve ever heard of, and probably most that I haven’t heard of as well.)
-
@PeterJones I guess we didn’t understand each other.
Guys, I didn’t mean to offend anyone.
I just replied that I really don’t have any skills.
If my task is complicated and notepad++ tools are not enough.
Let’s solve this problem together.
I don’t mind learning if you all help me. -
I didn’t know it would be so complicated
I thought it would be a command or just a program like winmerge, but it’s no help to me -
It would be easier for all of us
Maybe you know but does not notepad have a function to sort text like this:
BEFORE
public static var chatDialog:Object = {
“Intro1_1”:{
“text”:"'SSSSSSSSSSSSSSSS?
“actions”:[“Intro1_1”, “END1”],
{ “look”: “1111111111”
},
“Intro1_2”:{
{ “text”: “SSSSSSSSSSSSSSSSSSSSSSSSS!!!”
{ “actions”:[“END1”],
“toDo”:[“removeObject”,[“11111111”]]
AFTER
“text”:"'SSSSSSSSSSSSSSSSSS?
{ “text”: “SSSSSSSSSSSSSSSSSSSSSSSSSSS!!!”
I.e. all the text I need is sorted in order
I finished my tasks and sorted it in the order it was originally
Is there such a function? -
@fenzek1 ,
does not notepad have a function to sort text like this
Not natively. You seem to have a very high expectations for the “do what I mean” capability of a text editor. Your “isn’t that easy” are complicated tasks for a computer. And for a programmer to have anticipated every possible scenario like that, and implemented in the way that matches your expectations, is highly unlikely.
just a program like winmerge
Like winmerge, Notepad++ solves a particular set of problems. And Notepad++ gives you some pretty powerful tools (like regex, or the ability to install plugins) that allow even more than the Notepad++ team can imagine/implement. But the more complicated the task, the less likely it is that Notepad++ can handle it without help.
However, based on that sort-and-edit suggestion, I believe you could do a multi-step procedure like this:
- Add a ☺ to the beginning of every line using search/replace regex
- Do a column insertion to add line numbers to the current document (Edit > Column Editor…)
- Add a marker to any line with
"text":
using search/replace regex - Move those line numbers to the end of each line using search/replace regex
- Sort: Edit > Line Operations > Sort Lines Lexicographically Ascending
- At this point, the
"text":
lines should be first, in the same order they were originally. - Do your edits on those lines
- Undo steps 4 and 3
- search/replace to get line numbers at the beginning
- sort again
- remove line numbers
However, if you really don’t want sorting at all, but just want to focus on editing lines that have
"text":
, it might be easier to use @Alan-Kilborn’s recent script for the PythonScript plugin which will ask you for a regex, and then only show the lines that match that regex- for notes on how to install PythonScript plugin and run a supplied script, see this FAQ
- grab script from here
- from the discussion that follows that script, understand you might have to switch to a different tab and back to get the hiding to be correct, with the current version of that work-in-progress script
- run the script on your data, giving it the regex
"text":
to match only lines that have that indicator - do your edits
- run the script again with a blank regex (or using
Shift
+OK) to show all the lines again - verify it’s right, and save
(I believe it should be safe to save while those lines are hidden; @Alan-Kilborn can correct me if I’m wrong)
I think Alan’s script might be your best bet. But if you’d rather go the other way, see if you can give-it-a-go to implement the regex for the first few steps of my procedure.
----
Please note: This Community Forum is not a data transformation service; you should not expect to be able to always say “I have data like X and want it to look like Y” and have us do all the work for you. If you are new to the Forum, and new to regular expressions, we will often give help on the first one or two data-transformation questions, especially if they are well-asked and you show a willingness to learn; and we will point you to the documentation where you can learn how to do the data transformations for yourself in the future. But if you repeatedly ask us to do your work for you, you will find that the patience of usually-helpful Community members wears thin. The best way to learn regular expressions is by experimenting with them yourself, and getting a feel for how they work; having us spoon-feed you the answers without you putting in the effort doesn’t help you in the long term and is uninteresting and annoying for us.
-
Hmm, VERY complicated…
-
@Alan-Kilborn said in replacing a specific text from a another file:
Hmm, VERY complicated…
I read @fenzek1 say,
I don’t mind learning if you all help me.
… and hoped they were telling the truth. The sequence using your script in theory is
- Install PythonScript and save the script, as described in the FAQ
- Run the script with
"text":
- Unhide the text when done editing by running the script again with no search term
If they give that a go, and it works, great. If they come back and ask specific and meaningful questions, showing that they really do want to learn, then I will try to help (as long as they don’t continue to feel like a “do it for me” request).
But the complicated 11-step procedure was also intended to emphasize how the “simple” task that they tried to describe really isn’t as simple as they imagined it.
-
Actually, it was SO complicated (BTW, obviously that was a joke), that I didn’t read it all very closely; just noticed:
However, if you really don’t want sorting at all, but just want to focus on editing lines that have “text”:, it might be easier to use @Alan-Kilborn’s recent script for the PythonScript plugin which will ask you for a regex, and then only show the lines that match that regex
I don’t know if we should recommend that script at all until its shortcomings have been addressed. I’m still looking into that as time permits…
(I believe it should be safe to save while those lines are hidden; @Alan-Kilborn can correct me if I’m wrong)
Yes, light editing when lines are hidden is fine; for more detail see the cautions in the linked thread about it.
-
Thank you guys.
For your feedback to me.
I will study the subject of “regular expressions” in more detail.If it applies to my work and makes it VERY easy, then I must know something about it right.
I’ve looked at your answers before, and they’ve helped me with other obvious things, but obviously I didn’t understand anything about coding,
Still, your altruism and help made sense to me.
And the way you help people is nothing but respect.
Thank you from the bottom of my heart.I understand that old-timers are willing to give a year, a couple of years, or even a decade to learn.
And then someone like me shows up and “help me do it for me,” no, that’s not it, and that’s not the plan I had when I started my thread.You showed me, and for that I want to say thank you.