2021-11-26

Sort by first column, after by second if first contains duplicates etc

I have a simple .txt file, which contains table, where columns are divided by tabulation. So, I need to read data from the file and write to another in a sorted way. I need firstly sort by first column. If it contains duplicates values, values from second column should be sort (only ones which are against duplicates in the first column) and so on. Numbers are higher than letters, numbers are in increasing order, letters are in alphabetical order. So, if I have file like this

enter image description here

after sorting I need to have this one

enter image description here

I've found this one How do I sort records in a text file using Java?, but is there effective way to implement remaining sorting logic, not only by first column?



from Recent Questions - Stack Overflow https://ift.tt/3p3N3qo
https://ift.tt/3rfNMYx

No comments:

Post a Comment