[SunHELP] script challenge

Bashar sunhelp at sunhelp.org
Thu Feb 22 04:05:34 CST 2001


On Wed, 21 Feb 2001, Naser Ali wrote:

> Gurus,
> 
> I have an input file which has the following data in it,
> 
> ############ 20010216_200000 ###########
> 220
> 190
> 180
> 190
> 210
> 180
> 190
> 190
> 190
> 180
> The Average time for this ping is: 192
> ########################################
> 
> 
> ############ 20010216_203000 ###########
>  The listner is down at this time
> ########################################
> 
> What I would like to do is associate the "Average" time with the collection
> time and put it in a seperate file ignoring the rest, in the following
> format,
> 2001::02::16::192
> 
> I hope I am clear on this question.
> Any help or suggestion will be greatly appreciated.
> TIA

echo `date +%Y::%m::%d::``cat inputfile |grep Average |awk '{print $8}'` >
outputfile

that would do the job


                    KuwaitNet Communications Inc.
        Bashar A AlAbdulhadi            UNIX & NET Administrator
        bashar at kuwaitnet.net            http://www.KuwaitNet.net
        Phone: (KW) +965-2647060        Fax: (KW) +965-5337060
        Phone: (US) +514-2417955        Fax: (US) +208-2755778
        ICQ UIN: 19907999               Pager: (KW) 9312471
        IRC: Big @ #Kuwaitnet           YaHoO ID: kuwaitnets
        Toll free (from USA & Canada only)  1-888-KuwaitNET

           "Quality, Stability, 24 Hours Tech. Support"
                          "Think KuwaitNet"




More information about the SunHELP mailing list