Re: Get/find-question in script

From: Bill Thompson (wht_at_NEO.RR.COM)
Date: 12/29/03

  • Next message: Leyden, Joseph: "Re: change date of files in a directory"
    Date:         Mon, 29 Dec 2003 17:08:54 -0500
    To: aix-l@Princeton.EDU
    
    

    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


  • Next message: Leyden, Joseph: "Re: change date of files in a directory"