From owner-freebsd-questions@FreeBSD.ORG Tue Jul 13 23:46:35 2010 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BA5B1065676 for ; Tue, 13 Jul 2010 23:46:35 +0000 (UTC) (envelope-from perrin@apotheon.com) Received: from cpoproxy1-pub.bluehost.com (cpoproxy1-pub.bluehost.com [69.89.21.11]) by mx1.freebsd.org (Postfix) with SMTP id 180228FC27 for ; Tue, 13 Jul 2010 23:46:34 +0000 (UTC) Received: (qmail 9021 invoked by uid 0); 13 Jul 2010 23:46:34 -0000 Received: from unknown (HELO box543.bluehost.com) (74.220.219.143) by cpoproxy1.bluehost.com with SMTP; 13 Jul 2010 23:46:34 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=apotheon.com; h=Date:From:To:Subject:Message-ID:Mail-Followup-To:References:Mime-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent:X-Identified-User; b=TOldc6pYmcN59lK/teXorVvrfNrt/OhNnqQESlTK/YhEocEl4t/bqfgq3syn139x/Z4T/UIGMqyB4D12SfO9cHcdNuoSS36JlccQJdsOv9wtZYRgC5p8UhFWqWRj8x8s; Received: from c-24-8-180-234.hsd1.co.comcast.net ([24.8.180.234] helo=kukaburra.hydra) by box543.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1OYpBJ-000491-6I for questions@freebsd.org; Tue, 13 Jul 2010 17:46:34 -0600 Received: by kukaburra.hydra (sSMTP sendmail emulation); Tue, 13 Jul 2010 17:45:12 -0600 Date: Tue, 13 Jul 2010 17:45:12 -0600 From: Chad Perrin To: "questions@freebsd.org" Message-ID: <20100713234512.GA35912@guilt.hydra> Mail-Followup-To: "questions@freebsd.org" References: <4C3B26B4.1000208@comclark.com> <20100712155805.GD2192@libertas.local.camdensoftware.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline In-Reply-To: <20100712155805.GD2192@libertas.local.camdensoftware.com> User-Agent: Mutt/1.4.2.3i X-Identified-User: {2737:box543.bluehost.com:apotheon:apotheon.org} {sentby:smtp auth 24.8.180.234 authed with ren@apotheon.org} Cc: Subject: Re: .sh check for sufix g or m on size field 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: Tue, 13 Jul 2010 23:46:35 -0000 --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 12, 2010 at 08:58:05AM -0700, Chip Camden wrote: > Quoth Aiza on Monday, 12 July 2010: > > Sorry miss send, was not done yet. > >=20 > > Have a .sh script that accepts an -s sparse file size. > > Only 2 suffix's are valid m and g. > >=20 > > Been trying to get this line of code to strip out just the single=20 > > letter. But it strips the letter and every thing to the right of it. > >=20 > > Timagesize=3D`echo-n "${imagesize}" | sed 's/g.*$//'` > >=20 > > I plan to strip just the m or g if its there and the result should be= =20 > > numeric. If not numeric know invalid suffix. > >=20 > > Need help with the sed syntax. Or if there is better way I want to lear= n=20 > > it. > >=20 > > Thanks > > _______________________________________________ > > 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" >=20 > It sounds like what you want is simply: >=20 > sed 's/[gm]//' >=20 > Or am I missing something? I get the impression it's something more like this: sed 's/[gm]$//' I'm not sure, but there may be a need to check whether the rest of the line is solely numeric, too. The original question was not exactly clear on that point. --=20 Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] --7AUc2qLy4jB3hD7Z Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkw8+ogACgkQ9mn/Pj01uKUBpQCguOcZ8Vf1hGO/yBNtK7ime9U0 fk4An0kIlUXuS18Vj+3sbvZC/Mi4uU/5 =kHdA -----END PGP SIGNATURE----- --7AUc2qLy4jB3hD7Z--