I had tried that. It doesn't work:

# ls -d1 /dev/ad* | sort -n
/dev/ad10
/dev/ad4
/dev/ad6
/dev/ad8

I want the ad10 to appear last...

-----Original Message-----
From: Giorgos Keramidas [mailto:keram...@ceid.upatras.gr] 
Sent: Saturday, November 28, 2009 4:31 PM
To: Peter Steele
Cc: freebsd-questions@freebsd.org
Subject: Re: Sorting a device list

On Sat, 28 Nov 2009 11:48:18 -0600, Peter Steele <pste...@maxiscale.com> wrote:
> Can anyone recommend a quick and dirty way to sort a device list? For 
> example, if I do this:
>
> ls /dev/ad* | sort
>
> I get something like this:
>
> /dev/ad10
> /dev/ad4
> /dev/ad6
> /dev/ad8

Just use `sort -n':

    ls -d1 /dev/ad* | sort -n

It should work fine even when there are non-numeric prefix strings.


_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to