English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 18 October 2021, 20:39   #1
Torti-the-Smurf
Registered User
 
Torti-the-Smurf's Avatar
 
Join Date: Dec 2018
Location: Earth
Posts: 1,058
Is there a Tool to Sort This Script ?

Hi dear EAB Reader.

I search for a Tool to sort this Text below. (hole text attached)

It´s the Setup Script for my Lazybench.

If that would be alphabetically sorted, then Lazybench would be faster

Can somebody name a Tool that let me do that ?

Any Ideas

Would be nice
Attached Thumbnails
Click image for larger version

Name:	sample.jpg
Views:	102
Size:	299.7 KB
ID:	73525  
Attached Files
File Type: zip Lazybench.zip (7.5 KB, 58 views)
Torti-the-Smurf is offline  
Old 18 October 2021, 21:03   #2
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
There is a sort command but I think it's buggy. It comes with the OS. What version of the OS are you running?
Samurai_Crow is offline  
Old 18 October 2021, 21:12   #3
amigasith
Registered User
 
amigasith's Avatar
 
Join Date: Jan 2013
Location: Wild South / Germany
Age: 48
Posts: 271
Linux command line hacking to the rescue

You can use this Linux command line to do the job:

Code:
awk -F "/" '{print $NF"|"$0}' Lazybench.menu | sort -i | cut -d "|" -f 2- > Lazybench_sorted.menu
Explanation:

- All lines of the input file Lazybench.menu will be passed to awk, one line after the other
- awk will print out new lines, with the last field of every input line at the beginning of every new line, where "/" is the field delimiter in this command
- sort -i will sort the output (meaning the newly created lines of awk) case insensitive
- Last but not least, cut -d "|" -f 2- will cut off the mentioned "last field" value that awk pre-pended previously

Happy hacking

Edit: Attaching the sorted menu, just in case.
Attached Files
File Type: zip Lazybench_sorted.menu.zip (7.7 KB, 53 views)

Last edited by amigasith; 18 October 2021 at 21:18.
amigasith is offline  
Old 18 October 2021, 21:19   #4
Korodny
Zone Friend
 
Join Date: Sep 2001
Location: Germany
Posts: 812
AFAIK, there is no way to sort this using AmigaOS' default tools. You would have to install some of the GNU text utilities to get this done.

How do you generate that list? It does not seem to contain readme files and stuff like that, so you're apparently not scanning for .info files?

What you could do is:

1. generate a list of all .info files containing only the filenames (not tested, doublecheck the syntax before using it):

Code:
list all files lformat="%s" pat="#?.info"
2. Sort that list using the sort command

3. use a batch script that parses the list line by line and (a) locates the filename on disk (b) writes the full path to the file including the filename to a new textfile.

The new textfile would then be the final list you use for Lazybench.
Korodny is offline  
Old 18 October 2021, 21:32   #5
Torti-the-Smurf
Registered User
 
Torti-the-Smurf's Avatar
 
Join Date: Dec 2018
Location: Earth
Posts: 1,058
Quote:
Originally Posted by Samurai_Crow View Post
There is a sort command but I think it's buggy. It comes with the OS. What version of the OS are you running?
Customiced 3.9 WB with the 3.1.4 Workbench Library.

Linux is out of the question for me. (dont have it)

The File is the "Config" for LazyBench. (it shows LazyBench the Location of my Games) . The File is just a standard Amiga Text file like the Startup-Sequence is.

Would be neat if that Text would be sorted A-Z. Then LazyBench would not have to do it everytime


@ Korodny

I created it by Hand Yes !!!

The Stuff seems so complicated Damn ,I think i am to stupid for that Never used the Sort command once in my Life
Torti-the-Smurf is offline  
Old 18 October 2021, 21:46   #6
Torti-the-Smurf
Registered User
 
Torti-the-Smurf's Avatar
 
Join Date: Dec 2018
Location: Earth
Posts: 1,058
Quote:
Originally Posted by amigasith View Post
Linux command line hacking to the rescue

You can use this Linux command line to do the job:

Code:
awk -F "/" '{print $NF"|"$0}' Lazybench.menu | sort -i | cut -d "|" -f 2- > Lazybench_sorted.menu
Explanation:

- All lines of the input file Lazybench.menu will be passed to awk, one line after the other
- awk will print out new lines, with the last field of every input line at the beginning of every new line, where "/" is the field delimiter in this command
- sort -i will sort the output (meaning the newly created lines of awk) case insensitive
- Last but not least, cut -d "|" -f 2- will cut off the mentioned "last field" value that awk pre-pended previously

Happy hacking

Edit: Attaching the sorted menu, just in case.

THAT WAS AMAZING !!!! THANK YOU SO MUCH !!!!!!


! That saved me from a Headache !


Thank you AmigaSith, you made Lazybench faster now !!!


That´s so cool


All the best to all the EAB People, youre always so nice and helpful !



Thank You !


[ Show youtube player ]

Last edited by Torti-the-Smurf; 18 October 2021 at 21:47. Reason: Thanks again for the File , You did it !! I wanna say, Thank you !
Torti-the-Smurf is offline  
Old 18 October 2021, 21:54   #7
amigasith
Registered User
 
amigasith's Avatar
 
Join Date: Jan 2013
Location: Wild South / Germany
Age: 48
Posts: 271
No problem Glad I could help
amigasith is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
How was that tool called ? It reboots and execute a certain Script Torti-the-Smurf support.Apps 8 27 November 2021 23:44
IconX - read tool types from script? Sim085 support.Apps 15 26 August 2020 10:37
PFS-Defrag Tool - Need Script? ahandyman59 support.Apps 2 28 April 2020 02:01
Script to update tool types of slaves for quit key? emuola project.WHDLoad 17 15 March 2017 18:26

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:06.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07855 seconds with 14 queries