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
[-- Attachment #1 --]
Quoth Aiza on Monday, 12 July 2010:
> Sorry miss send, was not done yet.
>
> Have a .sh script that accepts an -s sparse file size.
> Only 2 suffix's are valid m and g.
>
> Been trying to get this line of code to strip out just the single
> letter. But it strips the letter and every thing to the right of it.
>
> Timagesize=`echo-n "${imagesize}" | sed 's/g.*$//'`
>
> I plan to strip just the m or g if its there and the result should be
> numeric. If not numeric know invalid suffix.
>
> Need help with the sed syntax. Or if there is better way I want to learn
> it.
>
> 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"
It sounds like what you want is simply:
sed 's/[gm]//'
Or am I missing something?
--
Sterling (Chip) Camden | sterling@camdensoftware.com | 2048D/3A978E4F
http://camdensoftware.com | http://chipstips.com | http://chipsquips.com
[-- Attachment #2 --]
-----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-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100712155805.GD2192>
