help with wget script.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help with wget script.
# 1  
Old 11-29-2008
help with wget script.

#!/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 obstained string.

Thanks in advance.
# 2  
Old 11-29-2008
I couldn't access those servers but assuming you can, here is an example of how to use wget to read text from the web into an environment variable:
Code:
IP="$(wget -o/dev/null -O- http://jackson.io/ip/)"

The switch -o/dev/null throws away all the noisy information about the transfer. You could use -q instead.

The switch -O- (dash capital-O dash) pipes the output to stdout.

The syntax ="$( )" captures it. This is the same as using back-ticks, but I think this syntax is clearer.
# 3  
Old 11-30-2008
Hi , can anyone please help me. I am waiting for the answer.

HI can anyone help me, i am waiting for reply. since i have to complete my module it is urgent . can anyone help me please
# 4  
Old 11-30-2008
Help me

The content in Z before command
--19:17:12-- http://napdweb37.eao.abn-iad.ea.com:.../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
19:17:13 (3.36 MB/s) - `-' saved [67/67]
<html> <head> </head> <body> Test JSP page. </body> </html>
The content in Z after command
<ht


THis is the output i am getting, but i want to do substring operation on full ouput. I am able to acess only that html output . Can anyone help me how can i acess full output.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wget - working in browser but cannot download from wget

Hi, I need to download a zip file from my the below US govt link. https://www.sam.gov/SAMPortal/extractfiledownload?role=WW&version=SAM&filename=SAM_PUBLIC_MONTHLY_20160207.ZIP I only have wget utility installed on the server. When I use the below command, I am getting error 403... (2 Replies)
Discussion started by: Prasannag87
2 Replies

2. Shell Programming and Scripting

Formatting wget request within script

When using a browser and calling this url .. the data returns the proper range of information ichart dot finance dot yahoo dot com/table.csv?s=YAHOO&a=3&b=14&c=2012&d=03&e=20&f=2012&g=d&ignore.csv (geeze wont let me post url's sorry ) However in my script the formatting is messing up on... (4 Replies)
Discussion started by: harte
4 Replies

3. Shell Programming and Scripting

Shell script with wget in ssh command

Hi, I am using a linux with bash. I have a script written which will login to a remote server and from there it runs a "wget" to downlaod a build file from a webserver. Here is the line inside the script: ssh -t -q -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@${a}'wget... (4 Replies)
Discussion started by: sunrexstar
4 Replies

4. Shell Programming and Scripting

wget won't from script

I am trying to use wget to capture a web page on the Internet. If I use the command from a terminal like: wget Whidbey Island, Naval Air Station WA Weather -O /tmp/FIL.tmp it works but if I use it in a bash script the size of /tmp/FIL.tmp is zero. Can someone help me. Should I not be using... (5 Replies)
Discussion started by: slak0
5 Replies

5. Shell Programming and Scripting

Shell Script help - MP3 Downloader using Wget

I want to make a script to use wget to find and download mp3s on a website into a directory with a name derived from that URL. So far I have: #!/bin/sh echo “MP3 Downloader” echo -n "Enter full URL address of website or website subdirectory > " read text cd ~ mkdir $text cd $text ... (3 Replies)
Discussion started by: Garnett
3 Replies

6. Shell Programming and Scripting

Using wget in a Perl script

Hi, I've written a script in Perl that generates a URL and prints it. So if I run the script from the command line, I get something like this: $ script.pl http://www.url.com/folder/file.extI would like to use this script with wget to download the file at the URL generated. Is there a simple... (2 Replies)
Discussion started by: Altay_H
2 Replies

7. UNIX for Dummies Questions & Answers

wget --dns-timeout script

#!/bin/sh # 'clear' for i in $(seq -w 15 37); do echo $i wget --dns-timeout=0.0001 http://napdweb${i}.eao.abn-iad.ea.com:8000/webcore/test/test.jsp -o 1 A=`cat 1` C=$(expr "$A" :... (1 Reply)
Discussion started by: veerumahanthi41
1 Replies

8. Shell Programming and Scripting

How to script wget in bash?

The script below is giving me grief! The error message says /download.bash: line 16: syntax error near unexpected token `else' ./download.bash: line 16: `else wget "http://downloads.sourceforge.net/hibernate/hibernate-3.2.5.ga.zip?modtime=1185893922&big_mirror=1" ' I think it must be a... (1 Reply)
Discussion started by: siegfried
1 Replies

9. Shell Programming and Scripting

Script to download file using wget

Hi I need a Shell script that will download a text file every second from a http server using wget. Can anyone provide me any pointers or sample scripts that will help me go about this task ??? regards techie (1 Reply)
Discussion started by: techie82
1 Replies

10. UNIX for Advanced & Expert Users

Wget call in a Perl script

I've got to do a wget call in a Perl Script. I am basically doing migration of a shell script which was previously doing it. The code in the sh file was as follows. wget -nv -o /tmp/wget.run.log -t 5 -w 10 http://windows-server/myapp/1try.asp?myparam=no This wget command is executing an... (1 Reply)
Discussion started by: rahulrathod
1 Replies
Login or Register to Ask a Question