Date: Mon, 12 Jul 2010 08:58:05 -0700 From: Chip Camden <sterling@camdensoftware.com> To: "questions@freebsd.org" <questions@freebsd.org> Subject: Re: .sh check for sufix g or m on size field Message-ID: <20100712155805.GD2192@libertas.local.camdensoftware.com> In-Reply-To: <4C3B26B4.1000208@comclark.com> References: <4C3B26B4.1000208@comclark.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100712155805.GD2192>