I use wikipedia syntax in text area. My text looks like this...
=main-heading=
test
again
practice
==sub-heading==
america
usa
india
I use the bookmarklet that I found here...
https://gist.github.com/aquilax/ac94ea6003f2ddb1e1fd6195c00ac3d9
When I sort, I get this. How do I sort each section separately?
==sub-heading==
=main-heading=
again
america
india
practice
test
usa
Expected:
=main-heading=
again
practice
test
==sub-heading==
america
india
usa
This awk command works:
awk '/=/ {c++} {print c+1, $0}' t1.txt | sort -n | cut -d' ' -f2- | sed '/^$/d'
But awk can not be used in browser. Is it possible to include transform in JS bookmarklet?