From owner-freebsd-questions@FreeBSD.ORG Mon Jul 12 15:58:11 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 014D71065670 for ; Mon, 12 Jul 2010 15:58:11 +0000 (UTC) (envelope-from sterling@camdensoftware.com) Received: from wh2.interactivevillages.com (wh2.interactivevillages.com [75.125.250.34]) by mx1.freebsd.org (Postfix) with ESMTP id BF2BA8FC18 for ; Mon, 12 Jul 2010 15:58:10 +0000 (UTC) Received: from 174-21-99-21.tukw.qwest.net ([174.21.99.21] helo=_HOSTNAME_) by wh2.interactivevillages.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1OYLDm-0003Pp-Qu for questions@freebsd.org; Mon, 12 Jul 2010 08:47:08 -0700 Received: by _HOSTNAME_ (sSMTP sendmail emulation); Mon, 12 Jul 2010 08:58:05 -0700 Date: Mon, 12 Jul 2010 08:58:05 -0700 From: Chip Camden To: "questions@freebsd.org" Message-ID: <20100712155805.GD2192@libertas.local.camdensoftware.com> Mail-Followup-To: "questions@freebsd.org" References: <4C3B26B4.1000208@comclark.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9UV9rz0O2dU/yYYn" Content-Disposition: inline In-Reply-To: <4C3B26B4.1000208@comclark.com> User-Agent: Mutt/1.4.2.3i Company: Camden Software Consulting URL: http://camdensoftware.com X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - wh2.interactivevillages.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - camdensoftware.com 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: Mon, 12 Jul 2010 15:58:11 -0000 --9UV9rz0O2dU/yYYn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 learn= =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.o= rg" It sounds like what you want is simply: sed 's/[gm]//' Or am I missing something? --=20 Sterling (Chip) Camden | sterling@camdensoftware.com | 2048D/3A978E4F http://camdensoftware.com | http://chipstips.com | http://chipsquips= .com --9UV9rz0O2dU/yYYn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iQEcBAEBAgAGBQJMOzuNAAoJEIpckszW26+RKnMIALUajldAomMbYgRA1W79wQwc jDvvXa3hkzXKSLCPHCrKkpXnRXvo4CY4xHU43Mhrl7U6vbSt5vvI+nbbQcfVHICR UMw63s3xAav8fV2a857fUY+ojLG8ZVCaWrgppwWBohCHFTyzq3+ygyzS4EWhMoTH qiw8ZMmIps4lCvw9z635ypEMjoEgpuxXEC7J98zRwrW60qB8wd0I9qKJaQKkK58Y v33L4w+V4m9MJgrB6y/L9pA/Obm+/cX6YcJBoG0gXGJerDdOQPERtQAqlpfFu8nQ Yjs6WeYP2/IkURiUX3+QWuvc2HPFi2H8zir2IWfSyuuwaBspdFnmhnH6/m3VA8k= =eEQl -----END PGP SIGNATURE----- --9UV9rz0O2dU/yYYn--