Sorting "Folded Blocks" or "Colapsed Level 1"
Cristi C last edited by
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.)
I hope someone can help.
MAPJe71 last edited by
AFAIK not with the build in sort functionality.
I’d use one of the script plugin’s (PythonScript, LuaScript).
Cristi C last edited by
Unfortunately I don’t have enough knowledge in scripting to achieve what I want.
Jim Dailey last edited by Jim Dailey
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.
Scott Sumner last edited by
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>.
Jim Dailey last edited by
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. :-)