Re: Get/find-question in script

From: Bill Thompson (wht@NEO.RR.COM)
Date: Mon Dec 29 2003 - 17:08:54 EST


One bit of caution with using bc to remove the leading zeros - if the serial
number contains any non-numeric characters (and I have no idea whether or
not they do) bc will blow up. It's safer to use sed (e.g.: sed -e
's/^00*//')

Bill Thompson
Sr UNIX Systems Administrator
The Goodyear Tire & Rubber Co.

Contains Confidential and/or Proprietary Information
May Not Be Copied or Disseminated Without Express Consent of The Goodyear
Tire & Rubber Company.

AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2

----- Original Message -----
From: "Jan-Frode Myklebust" <janfrode@PARALLAB.UIB.NO>
Newsgroups: bit.listserv.aix-l
To: <aix-l@Princeton.EDU>
Sent: Monday, December 29, 2003 3:11 PM
Subject: Re: Get/find-question in script

> On Mon, Dec 29, 2003 at 08:29:37PM +0100, brian welsh wrote:
> >
> > If I run the following command, I receive the following output:
> > $ lscfg -vl rmt1 | grep Serial | awk '{print $2}'
> > Number...............000000057149
> >
> > Can anyone give me a hint which command to use if I only want to have:
> > 000000097418
>
> Substitute the dots with spaces and print $3:
>
> % lscfg -vl rmt1 | grep Serial | sed 's/\./ /g'|awk '{print $3}'
> 6811092091
>
> > or
> > 97418
>
> Feed the number to 'bc':
>
> % lscfg -vl rmt1 | grep Serial | sed 's/\./ /g'|awk '{print $3}' | bc
> 6811092091
>
> Ooops, my serial didn't contain any leading zeros...
>
> % echo 000000097418 | bc
> 97418
>
>
> -jf



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:25 EDT