Sorting "Folded Blocks" or "Colapsed Level 1"
-
Can Notepad++ sort this code, I want to sort the javascript code ascending so rawValue 1,2,3, … and so on.
The idea is to preserve the content of the folded block under the “if” where is now. (The content of the if is bound to it.)
http://oi63.tinypic.com/301pwjm.jpg
I hope someone can help. -
AFAIK not with the build in sort functionality.
I’d use one of the script plugin’s (PythonScript, LuaScript).
On the other hand, why not use a JavaScript script? -
Unfortunately I don’t have enough knowledge in scripting to achieve what I want.
Thanks anyway. -
@Cristi-C
I don’t know of any sorting program that handles “blocks” of lines.As MAPJe71 said, you will likely have to write a stand-alone program or a script of some sort to do what you want.
I’ve said it before on this forum, and I’ll say it again here: If you code in any language or often work with text files that you occasionally need to rearrange or from which you need to extract data, you should really, really, REALLY set aside time to learn a scripting language. The time you invest will be returned ten-fold (or much more if you work in these areas for as long as I have).
I prefer AWK because it handles all of my text manipulation needs and is IMHO simpler to learn and use than your other choices. But there are lots of others that have even more powerful abilities if you need them.
If you want to investigate AWK, you can download the GNU AWK executable from here: https://sourceforge.net/projects/ezwinports/files/gawk-4.1.4-w32-bin.zip/download and you can get the manual from here: https://www.gnu.org/software/gawk/manual/gawk.pdf Keep in mind the manual is written for people using GAWK in a POSIX shell, and the quoting rules in a Windows command shell are different.
-
No disrepect meant to AWK, Jim, but I’ve used both AWK and Python and I find Python to be easier in the long run. Another benefit to Python is that learning it gives you pretty much everything you need to code Pythonscript extensions for Notepad++. But I agree with the general point you made, 100%–learn something instead of being disappointed that Notepad++ can’t natively do <insert-very-specific-and-important-to-only-you-task-here>.
-
Back in the day we used to have flame wars over which editor was the only one worth using. Now that all right-thinking people have settled on Notepad++, I guess we can spar over the best scripting language! :-)
Well, we could if I was of a mind to (and believe me, 25 years ago or so I would have been), but I don’t have the time or desire to care about the details any more. :-)