Please resolve it


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Please resolve it
# 1  
Old 12-01-2008
Please resolve it

Code:
#!/bin/sh# 'clear'for i in $(seq -w 15 37)doecho $iecho The content in ZZ=`wget --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.co.../test/test.jsp`echo $ZA="Connection timed out."echo The content in Aecho $Aexpr "$A" : '..\(...\)'echo $Adone
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


Code:
#!/bin/sh# 'clear'for i in $(seq -w 15 37)doecho $iecho The content in Z before commandZ="$(wget --dns-timeout=5.0 -O - http://napdweb${i}.eao.abn-iad.ea.co.../test/test.jsp)"echo $Zecho The content in Z after command expr "$Z" : '..\(..\)'#$ wget --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.co.../test/test.jsp > apple#$ cat appleecho The value in A before commandA="--03:52:29--  http://napdweb37.eao.abn-iad.ea.com:.../test/test.jspResolving napdweb37.eao.abn-iad.ea.com... failed: Connection timed out."echo $Aecho The value in A after command expr "$A" : '..............................................................................................................................\(.....................\)'done
I got the following output 


Code:
The content in Z before command--03:29:11--  http://napdweb37.eao.abn-iad.ea.com:.../test/test.jspResolving napdweb37.eao.abn-iad.ea.com... 10.120.244.76Connecting to napdweb37.eao.abn-iad.ea.com|10.120.244.76|:8000... connected.HTTP request sent, awaiting response... 200 OKLength: 67 [text/html]Saving to: `STDOUT'100%[====================================================================================================================>] 67          --.-K/s   in 0s03:29:12 (10.6 MB/s) - `-' saved [67/67]<html> <head> </head> <body> Test JSP page. </body> </html>The content in Z after command<hThe value in A before command--03:52:29-- http://napdweb37.eao.abn-iad.ea.com:.../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.

# 2  
Old 12-01-2008
Please post your code between [ code ] tags, otherwise it is comletely unreadable.
# 3  
Old 12-02-2008
Help me in resolving it

Code:
#!/bin/sh# 'clear'for i in $(seq -w 15 37)doecho $iecho The content in ZZ=`wget --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.co.../test/test.jsp`echo $ZA="Connection timed out."echo The content in Aecho $Aexpr "$A" : '..\(...\)'echo $Adone

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


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

I got the following output


Code:
The content in Z before command--03:29:11--  http://napdweb37.eao.abn-iad.ea.com:.../test/test.jspResolving napdweb37.eao.abn-iad.ea.com... 10.120.244.76Connecting to napdweb37.eao.abn-iad.ea.com|10.120.244.76|:8000... connected.HTTP request sent, awaiting response... 200 OKLength: 67 [text/html]Saving to: `STDOUT'100%[====================================================================================================================>] 67          --.-K/s   in 0s03:29:12 (10.6 MB/s) - `-' saved [67/67]<html> <head> </head> <body> Test JSP page. </body> </html>The content in Z after command<hThe value in A before command--03:52:29-- http://napdweb37.eao.abn-iad.ea.com:.../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.

Last edited by vbe; 12-02-2008 at 05:49 AM.. Reason: added tags...
# 4  
Old 12-02-2008
# 5  
Old 12-04-2008
I worry about you getting this code to work if you have so much trouble just posting it in a forum!

Anyway, perhaps try this?

Code:
#!/bin/sh
# 'clear'
for i in $(seq -w 15 37)
do
  echo $i
  ZZ=`wget -qO- --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.co.../test/test.jsp`
  echo The content in ZZ
  echo $ZZ
  if echo $ZZ | grep -q 'somesubstring'
  then
    echo ZZ contains somesubstring
  fi
  # Not sure what these parts are supposed to do?
  # echo $ZA="Connection timed out."
  # echo The content in A
  # echo $A
  # expr "$A" : '..\(...\)'
  # echo $A
done

# 6  
Old 12-04-2008
Unix on CD

Hello All,

I'm using Windows Vista.
I would like to know more about UNIX and I want to be able work from home.
Is there any option to run Unix on my system, from the CD drive (I mean, without installing)?

Thanks.
# 7  
Old 12-04-2008
You should start your own thread for a separate topic.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Could not resolve ip through DNS

Dear all , Very recently our DNS server ip got changed. I have entered the DNS ip in /etc/resolv.conf ...but I could not resolv it for my ip address. Verified that , the IP is added in the DNS also. It is still working with the old DNS ip. Please let me know what could be... (11 Replies)
Discussion started by: jegaraman
11 Replies

2. Shell Programming and Scripting

Cannot resolve $var in awk

My script ---------- for i in `cat n`;do export k=`echo "CSN: "$i` //combining CSN: and value from n echo "$k" awk ''{print "CSN: "$0;}'{_=29}_&&_--' file1|tail -1 >> file2 done In the above script i cannot able to resolve $k in awk command file n contains ------------ 0000 1111... (0 Replies)
Discussion started by: Mohana29_1988
0 Replies

3. Shell Programming and Scripting

Resolve Environment Variable

I am tyring to resolve an environment variable that is part of a string I selected from our database. Simply put, I want cd to this folder before checking if a file exists. The variable $in_loc has the value '$PS_HOME/int/VSP' where $PS_HOME is the environment variable. I am using cd... (6 Replies)
Discussion started by: consult_jb
6 Replies

4. Shell Programming and Scripting

Please help to resolve the below script

Dear Members, Please help me to resolve below script. The script is used to send the attachment in the mail with all the details. However in one of the incidents, the attachment in the mail was blank. Now the client is after me to get it resolved ASAP. So prompt response would be highly... (2 Replies)
Discussion started by: SKO_TC
2 Replies

5. UNIX for Dummies Questions & Answers

Resolve IP to Hostname?

Good day, I would like to resolve IP's to Hostnames using Putty. I'm using Mandriva Linux 2008.0. Is this possible? Perhaps with nmap? (13 Replies)
Discussion started by: McGuywer
13 Replies

6. Shell Programming and Scripting

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 ... (1 Reply)
Discussion started by: veerumahanthi41
1 Replies

7. Shell Programming and Scripting

Resolve a Variable

Hi I have a variable which is a path ie: UBERROR=/cobwrk/mchr/prodsup/ub/wrk/../error is there anyway I can get the output of an echo to read: #echo $UBERROR /cobwrk/mchr/prodsup/ub/error instead of #echo $UBERROR /cobwrk/mchr/prodsup/ub/wrk/../error Many thanks! (2 Replies)
Discussion started by: serm
2 Replies

8. UNIX for Dummies Questions & Answers

how do u resolve this????

Please help me on how to resolve: 1-unresponsive terminals 2-unresponsive applications 3-how to interrupt processe p.s unix/linux OS (1 Reply)
Discussion started by: zizu
1 Replies

9. IP Networking

Cannot Resolve Host Name

I am running LexMark MarkNetPro-3 print servers on my AIX network. All of the sudden, none of my printers will print anymore. I am getting an error message on the console: Unable to resolve host name. This message comes up everytime a user submits a print job. Any Ideas? (1 Reply)
Discussion started by: Docboyeee
1 Replies
Login or Register to Ask a Question