Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Nov 2009 02:30:44 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Peter Steele <psteele@maxiscale.com>
Cc:        "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: Sorting a device list
Message-ID:  <87hbsexjd7.fsf@kobe.laptop>
In-Reply-To: <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEAB5@MBX03.exg5.exghost.com> (Peter Steele's message of "Sat, 28 Nov 2009 11:48:18 -0600")
References:  <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEAB5@MBX03.exg5.exghost.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 28 Nov 2009 11:48:18 -0600, Peter Steele <psteele@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.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87hbsexjd7.fsf>