Date: Sat, 28 Nov 2009 11:48:18 -0600 From: Peter Steele <psteele@maxiscale.com> To: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Sorting a device list Message-ID: <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEAB5@MBX03.exg5.exghost.com>
next in thread | raw e-mail | index | archive | help
Can anyone recommend a quick and dirty way to sort a device list? For examp= le, if I do this: ls /dev/ad* | sort I get something like this: /dev/ad10 /dev/ad4 /dev/ad6 /dev/ad8 I can add -g, but it doesn't help: ls /dev/ad* | sort -g /dev/ad10 /dev/ad4 /dev/ad6 /dev/ad8 I need to skip the device prefix before applying the -g option. Something l= ike this works: ls /dev/ad*|sort -g -k 1.8 /dev/ad4 /dev/ad6 /dev/ad8 /dev/ad10 but this assumes the device name is just two characters long. I want a quic= k way to sort a generic device list like this, considering only the numeric= part of the device for the key. Is there a quick and dirty way to do this = or do I need to pipe it into a perl script or something?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEAB5>