Date: Sun, 29 Nov 2009 12:47:26 -0600 From: Peter Steele <psteele@maxiscale.com> To: Oliver Mahmoudi <olivermahmoudi@gmail.com> Cc: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: RE: Sorting a device list Message-ID: <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEAEB@MBX03.exg5.exghost.com> In-Reply-To: <6b4b2d2c0911291036v358eb322m5bdf470e450f78ba@mail.gmail.com> References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEAB5@MBX03.exg5.exghost.com> <87hbsexjd7.fsf@kobe.laptop> <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEADA@MBX03.exg5.exghost.com> <6b4b2d2c0911291036v358eb322m5bdf470e450f78ba@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
I ended up using ls /dev/ad*|sort -g -k1.8 Not quite as generic as I wanted but it works... From: Oliver Mahmoudi [mailto:olivermahmoudi@gmail.com] Sent: Sunday, November 29, 2009 10:36 AM To: Peter Steele Cc: freebsd-questions@freebsd.org Subject: Re: Sorting a device list you can try to delete the /dev/ad10 entry with sed and then just append it = to the end manually using the printf(1) utility like so: # ls /dev/ad* | sed s/"\/dev\/ad10"// | grep "/dev/ad" && printf "/dev/ad10= \n" Does that help? Oliver On Sun, Nov 29, 2009 at 6:56 AM, Peter Steele <psteele@maxiscale.com<mailto= :psteele@maxiscale.com>> wrote: 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:keramida@ceid.upatras.gr<mailto:keramida@ce= id.upatras.gr>] Sent: Saturday, November 28, 2009 4:31 PM To: Peter Steele Cc: freebsd-questions@freebsd.org<mailto:freebsd-questions@freebsd.org> Subject: Re: Sorting a device list On Sat, 28 Nov 2009 11:48:18 -0600, Peter Steele <psteele@maxiscale.com<mai= lto:psteele@maxiscale.com>> wrote: > Can anyone recommend a quick and dirty way to sort a device list? For exa= mple, 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<mailto:freebsd-questions@freebsd.org> mailing= list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org= <mailto:freebsd-questions-unsubscribe@freebsd.org>"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEAEB>