SublimeText - sort json list alphabetically - sorting

I have a json formated list of countries and their ISO codes:
.
.
{"cod":"NC", "nombre":"Nueva Caledonia"},
{"cod":"NE", "nombre":"Níger"},
{"cod":"NF", "nombre":"Islas Norkfolk"},
{"cod":"NG", "nombre":"Nigeria"},
{"cod":"NI", "nombre":"Nicaragua"},
{"cod":"NL", "nombre":"Países Bajos"},
.
.
The list is sorted alphabetically but by the ISO code and not by the name. Is there any way to sort this list by name using sublime text or any other editor ?
Thanks

If you split "cod" and "nombre" then you will be able to use SublimeText functional: Select text, Edit -> Sort Lines or press F5

Old question, but no accepted answer. https://jsoneditoronline.org has a function to do this.
Click the "sort" button and it will let you choose the property to sort on the "field" key.

Related

What is the most common word in EmEditor

I got like 30mlion words in Emeditor format looks like:
Money
Love
Money
France
Telephone
Fork
.
.
.
I would like to know which word has the most repetitions. its possible to check it?
I dont want do it manualy like bookmarking or find next.
I would like it in this form or in any other:
3200 Money
3190 Love
etc.
In EmEditor, select Extract Frequent Strings on the Search menu, accept the default options, and click OK.
The result output of your sample will be like this:
If you prefer a macro, use this line:
document.selection.ExtractFrequent(eeFreqTypeLines, eeFindReplaceCase, 1, 100, "");
To run this, save this code as, for instance, Macro.jsee, and then select this file from Select... in the Macros menu. Finally, select Run Macro.jsee in the Macros menu while a document with a list of words is active.

Display number of filitering results sets

According to my question
Begin-/Endfilter
Is it possible in EmEditor to display the number of filtered results sets (could be equal to number of lines, if not using the Begin-/Endfilter) in the status bar of EmEditor; i found no options in the settings?
After you filter, how about searching for the end filter with the Count Matches option?
If you use a macro, I added the Find line to the last of the previous macro. You can use this macro instead:
filters = document.filters;
filters.Clear();
filters.AddFind( "|Column1", eeFindReplaceCase, eeExFilterBegin );
filters.AddFind( "| Number of Records:", eeFindReplaceCase, eeExFilterEnd );
document.filters = filters;
document.selection.Find( "| Number of Records: ", eeFindCount | eeFindReplaceCase );
You can run this macro after you open your data file. To do this, save this code as, for instance, Filter.jsee, and then select this file from Select... in the Macros menu. Finally, open your data file, and select Run in the Macros menu while your data file is active.
Before you run this macro, please deselect the Show Execution Time option in the Status page of the Customize dialog box.

can't display ordered list of markdown

I'am using Hexo to post my blog. I edited my blog by markdown. And I encountered with some problems when I try to use the ordered list and it can't be displayed normally.
Here is my code:
1. first
2. second
+ inner first
+ inner second
However, only disordered list was shown.
I would like it was shown as follow:
http://7xjj3m.com1.z0.glb.clouddn.com/20150622_0.jpg
but it was follow indeed:
http://7xjj3m.com1.z0.glb.clouddn.com/20150622_1.jpg
So, what's the problem?
Your syntax is correct but you need to indent by four spaces. I would refrain from using tab because your computer / program could be defaulted to 2 instead of 4.
I use a markdown editor called Mou; and I inputed your syntax and got the proper result.

Sort by specific column [duplicate]

This question already has answers here:
How to sort numeric and literal columns in Vim
(5 answers)
Closed 9 years ago.
If I have a text file with several tab-separated columns like this:
1 foo bar
3 bar foo
How would I sort based on the second or third column?
I read something like using :'<,'>!sort -n -k 2 in visual mode or :sort /.*\%2v/, but none of these commands seem to work.
You can use the built in sort command.
To sort by the second tab delimited column you can use :sort /[^\t]*\t/ to sort the second column.
To sort the third column you can use :sort /[^\t]*\t\{2}/
Generally just replace the number with the column number minus 1. (ie index columns with first column being index 0)
Sadly, it doesn't seem to be possible with the use of visual blocks inside the same file and/or with one command because :ex is linewise, i.e. Ctrl-v+ selection + :'<,'>sort would just sort the whole line either way.
A somewhat hacky "solution" would be to select whatever you want to sort with a visual block, sort it in another window and apply the changes to your original file. Something like this:
Ctrl-v + selection + x + :tabnew + p + :sort + Ctrl-vG$x + :q + `[P (align paste)
Source: Barry Arthur - Sort Me A Column (bairui from #vim#freenode).
The external sort, called via :'<,'>!sort -k 2 does work. Only if the -n flag (for numeric sorting) is given but the column you want to use is non-numeric, the result is not as expected. So to use the external sort, just drop -n in your example.
Remark: Also :'<,'>sort /.*\%2v/ does work for me.

xpath find text within a table

I am trying to find and select the text "Paris" within a dynamic table. When I run my selenium tests it can find the table and it can verify the text "Paris" exists however it cannot click Paris
I think it's something like this:
/html/body/div[class='yui-dt-liner']/td/tr[contains 'Paris']/div
Or:
//div[class='yui-dt-liner']/table/tr[contains text(), "Paris"]/div
But I can't get it to work. Any help will be appreciated.
Besides the "cannot click Paris" part (very much a Selenium specific type of question), both expression you'd provide are not sintactically correct.
Probably, they should be:
/html/body/div[#class='yui-dt-liner']/table/tr/td[contains(.,'Paris')]/div
And
//div[#class='yui-dt-liner']/table/tr/td[contains(.,'Paris')]/div
Note: # abbreviated form of attribute:: axis. Correct contains() function syntax. You should better use the string value of the element (. is the abbreviated form of self::node()) instead of the first text node child.

Resources