From owner-freebsd-questions@FreeBSD.ORG Mon Nov 30 05:13:01 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE6971065670 for ; Mon, 30 Nov 2009 05:13:01 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (unknown [IPv6:2607:f678:1010::34]) by mx1.freebsd.org (Postfix) with ESMTP id C665C8FC13 for ; Mon, 30 Nov 2009 05:13:01 +0000 (UTC) Received: from agora.rdrop.com (66@localhost [127.0.0.1]) by agora.rdrop.com (8.13.1/8.12.7) with ESMTP id nAU5D0uq044888 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 29 Nov 2009 21:13:01 -0800 (PST) (envelope-from perryh@pluto.rain.com) Received: (from uucp@localhost) by agora.rdrop.com (8.13.1/8.12.9/Submit) with UUCP id nAU5D0Jp044887; Sun, 29 Nov 2009 21:13:00 -0800 (PST) Received: from fbsd61 by pluto.rain.com (4.1/SMI-4.1-pluto-M2060407) id AA10492; Sun, 29 Nov 09 21:10:56 PST Date: Sun, 29 Nov 2009 21:10:57 -0800 From: perryh@pluto.rain.com To: psteele@maxiscale.com, olivermahmoudi@gmail.com Message-Id: <4b1353e1.Hqijnn9ZCQbcoq8k%perryh@pluto.rain.com> References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEAB5@MBX03.exg5.exghost.com> <87hbsexjd7.fsf@kobe.laptop> <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEADA@MBX03.exg5.exghost.com> <6b4b2d2c0911291036v358eb322m5bdf470e450f78ba@mail.gmail.com> In-Reply-To: <6b4b2d2c0911291036v358eb322m5bdf470e450f78ba@mail.gmail.com> User-Agent: nail 11.25 7/29/05 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Sorting a device list X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 05:13:02 -0000 Oliver Mahmoudi wrote: > 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" Or strip the non-numerics from the beginning of each line, and put them back after sorting: # pfx=/dev/ad ; ls -d1 ${pfx}* | sed "s;$pfx;;" | sort -n | sed "s;^;$pfx;"