Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jul 2010 22:29:08 +0800
From:      Aiza <aiza21@comclark.com>
To:        "questions@freebsd.org" <questions@freebsd.org>
Subject:   .sh  check for sufix g or m on size field
Message-ID:  <4C3B26B4.1000208@comclark.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C3B26B4.1000208>