please resolve the below problem

#!/bin/sh
# 'clear'
for i in $(seq -w 15 37)
do
echo $i
echo The content in Z
Z=`wget --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.com:8000/webcore/test/test.jsp`
echo $Z
A="Connection timed out."
echo The content in A
echo $A
expr "$A" : '..\(...\)'
echo $A
done

Hi,Please see the above program.
The above program works for me but my problem is that i need to store a value in string once i get the output from "wget".
Moreover i need to find a sub-string for the obtained string.
I tried by using -O- option also.Please see the below program

#!/bin/sh
# 'clear'
for i in $(seq -w 15 37)
do
echo $i
echo The content in Z before command
Z="$(wget --dns-timeout=5.0 -O - http://napdweb${i}.eao.abn-iad.ea.com:8000/webcore/test/test.jsp)"
echo $Z
echo The content in Z after command
 expr "$Z" : '..\(..\)'
#$ wget --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.com:8000/webcore/test/test.jsp > apple
#$ cat apple
echo The value in A before command
A="--03:52:29--  http://napdweb37.eao.abn-iad.ea.com:8000/webcore/test/test.jsp
Resolving napdweb37.eao.abn-iad.ea.com... failed: Connection timed out."
echo $A
echo The value in A after command
 expr "$A" : '..............................................................................................................................\(.....................\)'
done

I got the following output

The content in Z before command
--03:29:11--  http://napdweb37.eao.abn-iad.ea.com:8000/webcore/test/test.jsp
Resolving napdweb37.eao.abn-iad.ea.com... 10.120.244.76
Connecting to napdweb37.eao.abn-iad.ea.com|10.120.244.76|:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 67 [text/html]
Saving to: `STDOUT'
100%[====================================================================================================================>] 67          --.-K/s   in 0s
03:29:12 (10.6 MB/s) - `-' saved [67/67]
<html> <head> </head> <body> Test JSP page. </body> </html>
The content in Z after command
<h
The value in A before command
--03:52:29-- http://napdweb37.eao.abn-iad.ea.com:8000/webcore/test/test.jsp Resolving napdweb37.eao.abn-iad.ea.com... failed: Connection timed out.
The value in A after command
 Connection timed out

I have to extract the total output into a string but i am not able to do that.Once i get that into a string i have to do substring operation on it.
can anyone help me in resolving it.

You have asked this question already yesterday.

Take a look at the forum rules:

(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post or send a private message where your goal is to get an answer more quickly.