sort text file

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

sort text file

Post by tsolignani » 05 Mar 2020 17:17

Good evening everyone.

Anyone ever made a flow to alphabetically sort a text file with many lines each with a string?

Thank you.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: sort text file

Post by Desmanto » 05 Mar 2020 18:57

I don't remember there is any, but I use it in one part of my AM text tools branch. I retrieve the text from clipboard, sort it and set back to clipboard. The script is one line with nested function.

Code: Select all

clip_data = join(removeElementValue(sort(split(text, "\\r?\\n")), ""), "\n");
Replace text witth the text variable (file_text if you init the text file) and clip_data to the sorted variable.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

Re: sort text file

Post by tsolignani » 09 Mar 2020 11:38

Thank you so much. It does work like a charm!

You always deliver.

Thanks again and have a nice day.

Post Reply