I thought I remember reading that there is a text editor that exists for windows that allows the sorting of data, treating the csv/tsv similar to how it is treating when one sorts in excel.
Any pointer is appreciated it is driving me crazy.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Does it has to be a text editor? Or is a (portable) CSV/TSV editor also acceptable?
CSVed is an easy and powerful CSV file editor, you can manipulate any CSV file, separated with any separator.
Here is a screenshot of its sort functions
I can't think of a Windows editor that does this internally but Vim or Emacs can do it via some external tools, if that might be useful to you? Dealing with a proper CSV file would be a bit complicated but, for the simple case of a file like this example:
1,z,3 2,y,4 3,x,5
... a Vim command to sort the file by the second field in each line would be:
:%!cut -f2,1,3 -d, | sort | cut -f2,1,3 -d,
This relies on having
cut available (e.g. from the GNU textutils, which are available for Windows) and the usual Windows
sort, because the command will pipe the text through those external programs to do the work.
For a proper CSV file, though, it would be necessary to parse the CSV fully to deal with quoted commas before sorting by this method, and then to put the fields back into order again.
An example of piping through
sort from Vim can be found on StackOverflow here.