just a first idea,
load the file as a table and try
https://processing.org/reference/Table_sort_.html
table.sort(2);
but only if the 3 column structure is FIX
sorry, more restrictions: for table it must be “Tab” or “,” separated, " " will not work
// https://discourse.processing.org/t/processing-3-0-how-to-sort-string-array-by-value-of-substrings/6436
// https://processing.org/reference/loadTable_.html
// https://processing.org/reference/Table_sort_.html
// https://processing.org/tutorials/data/
String infilename = "data/bookmarks.txt";
String outfilename = "data/bookmarks_sort.txt";
Table mytable;
void setup() {
mytable = loadTable(infilename,"tsv");
// this "tsv" works only for <Tab> separated values
// but "csv" would work for "," separated values
// if the file has a first header line must use "header, tsv" so it would not be sorted as data
// a custom split like " " i not know how to do using table, only by loadString split
println(mytable.getRowCount() + " total rows in table");
println(mytable.getColumnCount() + " total cols in table");
mytable.sort(2);
saveTable(mytable,outfilename,"tsv");
exit();
}
/*
see file
data/bookmarks_sort.txt
content:
a a 1
aghf bsad 12
hlkjojto erewrui 1222
ytyi qwea 1222313
aerwjdu sdahdsu 123422313
aasd asdasa 23
*/
pls. see this last line v.s. your sorted 3d. line !!!
note:
tested on win 7 / 32bit / processing 3.4