Re: Get/find-question in script

From: Jan-Frode Myklebust (janfrode@PARALLAB.UIB.NO)
Date: Mon Dec 29 2003 - 15:11:46 EST


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