From owner-freebsd-questions@FreeBSD.ORG Sun Nov 29 18:36:07 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 144C31065692 for ; Sun, 29 Nov 2009 18:36:07 +0000 (UTC) (envelope-from olivermahmoudi@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id 9592E8FC13 for ; Sun, 29 Nov 2009 18:36:06 +0000 (UTC) Received: by fxm10 with SMTP id 10so2457086fxm.14 for ; Sun, 29 Nov 2009 10:36:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=Fv9Q5sUgUBHWdebPhFn+xA7/Q0+5Cbm4gYdAeek11MQ=; b=EYO8j+x0rdgpJjotMEqY5zXmu/a/pnO3H7lPMMgQKKKCI4lhRDrKyfVDKY+Eh7CK/o 68QDlF3OLDDCyBq+1G3FpGHFkJbZ06XKq781w8Xn5uDeJZ1Cu/krVhHYFDbsno+Cd/ax TMJ/QAMSHmnDwEAiWR1Qt9WxK+aUM3gds4VTc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=I4PD5S8drL7ftW8ShbglL//ARrRpUdbjqfc1WApTVA/3odyLfer8P1HQWtzYdNV+VY 61JtDAWFX5XcjQdcjyaRfaQuIXec/9GqNcyZacGvapkQ+SThw5/Cw3CYLByvURXnU8W0 CnnFoX+SU3cKyqWmxtW9H7/GAuC/+ttlj2kMk= MIME-Version: 1.0 Received: by 10.239.170.32 with SMTP id q32mr331777hbe.16.1259519765343; Sun, 29 Nov 2009 10:36:05 -0800 (PST) In-Reply-To: <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEADA@MBX03.exg5.exghost.com> References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEAB5@MBX03.exg5.exghost.com> <87hbsexjd7.fsf@kobe.laptop> <7B9397B189EB6E46A5EE7B4C8A4BB7CB33BBEADA@MBX03.exg5.exghost.com> Date: Sun, 29 Nov 2009 19:36:05 +0100 Message-ID: <6b4b2d2c0911291036v358eb322m5bdf470e450f78ba@mail.gmail.com> From: Oliver Mahmoudi To: Peter Steele Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 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: Sun, 29 Nov 2009 18:36:07 -0000 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 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] > 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 > 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-unsubscribe@freebsd.org" >