Shell Script:split the values

Hi,

I have file like below as file.txt

Linux sptpp1a 2.6.18 348.1.1.el5 xxxxx    05/02/2013

              %usr     %sys     %wio    %idle
14:18:30         0        1        0       99
14:18:40         1        1        0       98
14:18:50         1        1        0       98
14:19:00         0        1        0       99
14:19:10         1        2        0       97
14:19:20         0        0        0       99
14:19:30         0        0        0       99
14:19:40         1        1        0       98
14:19:50         2        1        0       97
14:20:00         8        1        0       91
14:20:10        20        3        0       77
14:20:20        26        2        0       72

I would like to get start and end time from file... I mentioned o/p below .

Output:

start=05/02/2013 14:18:30
end=05/02/2013 14:20:20

Thanks,
Mani

try this

admin@IEEE:~/Desktop$ cat test.txt
Linux sptpp1a 2.6.18 348.1.1.el5 xxxxx    05/02/2013

              %usr     %sys     %wio    %idle
14:18:30         0        1        0       99
14:18:40         1        1        0       98
14:18:50         1        1        0       98
14:19:00         0        1        0       99
14:19:10         1        2        0       97
14:19:20         0        0        0       99
14:19:30         0        0        0       99
14:19:40         1        1        0       98
14:19:50         2        1        0       97
14:20:00         8        1        0       91
14:20:10        20        3        0       77
14:20:20        26        2        0       72
admin@IEEE:~/Desktop$ cat test.sh

awk '/Linux/{start=$6}
       /usr/{getline;stm=$1}    
END{
    printf "start=" OFS start OFS stm
    printf "\n"
    printf "end=" OFS start OFS $1 
    printf "\n"
   }' test.txt
admin@IEEE:~/Desktop$ sh test.sh 
start= 05/02/2013 14:18:30
end= 05/02/2013 14:20:20

Thanks Akshay.... one more small change...

O/p should be:

start=2013-05-02 14:18:30
end=2013-05-02 16:25:12

please help on this... sorry for inconvenience

Thanks
Mani

I didn't find

16:25:12

in your file

if you want date to be formatted then

use this

awk '/Linux/{st=$6;split(st,A,"/");start=sprintf("%s-%s-%s",A[3],A[1],A[2])}

       /usr/{getline;stm=$1}    
END{
    printf "start=" OFS start OFS stm
    printf "\n"
    printf "end=" OFS start OFS $1 
    printf "\n"
   }' test.txt 

O/P

start= 2013-05-02 14:18:30
end= 2013-05-02 14:20:20

Thanks one again Akshay..... But i feel that will be little bit difficult to understand for me....

Any way i have noted that, if we can do the same in any different way( I meant any other comman)

Thanks,
Mani

awk 'NR==1{S=$NF}
    !P && /^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/{P=$1}
    END{printf "start="S,P"\nend="S,$1"\n"}' file