Re: Get/find-question in script

From: Jan-Frode Myklebust (janfrode_at_PARALLAB.UIB.NO)
Date: 12/29/03

  • Next message: Wood, Paul: "Re: Get/find-question in script"
    Date:         Mon, 29 Dec 2003 21:11:46 +0100
    To: aix-l@Princeton.EDU
    
    

    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: Wood, Paul: "Re: Get/find-question in script"

    Relevant Pages