English Amiga Board


Go Back   English Amiga Board > Support > New to Emulation or Amiga scene

 
 
Thread Tools
Old 07 April 2019, 21:08   #1
Danger Man
Registered User

 
Join Date: Sep 2017
Location: California, USA
Posts: 17
Sorting output from the list command

Just getting back into the Amiga and I'm hitting an issue with the 'list' shell command.

When I run 'list' in a directory, the results seem to be ordered by date, not by name. I saw on the AmigaDOS wiki there is a sort option but I couldn't get it to work.

Code:
list sort=name
Any ideas on this trivial issue?
Danger Man is offline  
Old 07 April 2019, 22:31   #2
malko
Ex nihilo nihil

malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 1,548
As you do not specify which version, here is the 1.3 command :

1. WB1.3> list sort

nothing more
malko is offline  
Old 07 April 2019, 22:31   #3
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,805
The sort option requires OS 3.9 or higher. Previous versions of List could not sort the output.

You can redirect the output into a file and use the Sort command to sort the file.

Code:
list >ram:tempfile
sort ram:tempfile ram:tempfile
type ram:tempfile
thomas is offline  
Old 07 April 2019, 22:50   #4
malko
Ex nihilo nihil

malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 1,548
You are right thomas.
I forgot that my example works because I have ARP installed...
malko is offline  
Old 07 April 2019, 23:31   #5
malko
Ex nihilo nihil

malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 1,548
By the way, it may have importance if you are doing scripting, so take care that when you output to a file and then sort the listing, some lines (filenote and listing summary) are no more on the expected place.
See screenshot.

I had a quick look and it seems that the 3.1.4 list does not allow to sort as well. @Thomas (Richter) is you are seeing this, maybe something worth to add
Attached Thumbnails
Click image for larger version

Name:	list_sort.gif
Views:	51
Size:	28.0 KB
ID:	62718  
malko is offline  
Old 08 April 2019, 00:16   #6
Danger Man
Registered User

 
Join Date: Sep 2017
Location: California, USA
Posts: 17
I'm running 3.1.4 so this explains why the sort option didn't work.
Thanks for the help
Danger Man is offline  
Old 08 April 2019, 00:41   #7
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 2,248
On 3.1.4 you can use pipe for it. "list | sort" or similar. thor has explained it somewhere.
daxb is offline  
Old 08 April 2019, 10:35   #8
malko
Ex nihilo nihil

malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 1,548
Quote:
Originally Posted by daxb View Post
On 3.1.4 you can use pipe for it. "list | sort" [...]
You are right.
On the other hand, the output result get also mixed -> filenotes and listing summary are not on place.
So, it could be a good idea to implement a "sort" argument (like in ARP's list command).
malko is offline  
Old 20 April 2019, 22:42   #9
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 163
Quote:
Originally Posted by malko View Post
You are right.
On the other hand, the output result get also mixed -> filenotes and listing summary are not on place.
So, it could be a good idea to implement a "sort" argument (like in ARP's list command).

I'm a believer of "one tool - one job". The list | sort idea works much nicer if you add an "LFORMAT" to list to get the file name output first, and the date (or whatever else you need) second, so sort gets the first column for sorting first.



If that is too long to type, an "alias" in the shell is your friend.


We should not enter the competition with Linux in "writing a command with more options than 'ls'". (-:
Thomas Richter is offline  
Old 21 April 2019, 10:03   #10
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 2,248
But "ls" hasn't so much options. "cvlc -H" for example gives you a funnier read with more then 5800 lines.
daxb is offline  
Old 21 April 2019, 15:33   #11
malko
Ex nihilo nihil

malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 1,548
Quote:
Originally Posted by Thomas Richter View Post
[...] We should not enter the competition with Linux in "writing a command with more options than 'ls'". (-:
Competition is good. Most of the time it's what makes things progress

Quote:
Originally Posted by Thomas Richter View Post
I'm a believer of "one tool - one job". The list | sort idea works much nicer if you add an "LFORMAT" to list to get the file name output first, and the date (or whatever else you need) second, so sort gets the first column for sorting first.

If that is too long to type, an "alias" in the shell is your friend. [...]
But the LFORMAT is not working as expected in 3.1.4. Did you try :
Code:
list lformat="%S"
It only results as 'S' being outputted...
So why not, while debugging the lformat of the list command, add a "sort" argument to make it more ARP 1.3 (or OS 3.9) like ?
malko 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
Sorting benchmark Samurai_Crow Coders. Nextgen 17 23 April 2017 03:20
List command repeats forever, how to solve? StoneOakvalley support.Apps 7 25 January 2014 02:50
Sorting out gotmashed MarketPlace 1 13 August 2007 11:49
A list of command line parameters D-Dan request.UAE Wishlist 0 10 June 2004 03:46
Sorting through my disk collection Jim Retrogaming General Discussion 10 10 September 2002 10:54

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 01:45.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.08773 seconds with 16 queries