Response Code using wget in shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Response Code using wget in shell
# 1  
Old 09-28-2006
Response Code using wget in shell

I am trying to get the status code of a web request,size of the download file and response time using wget.
When i use the command: wget <sitename> ,it gives all these parameters in the command line.But i want to get these values seperately and assign in different variables using shell script.Is it possible using wget?If any other methods are available i will appreciate that..

Thanks and Regards,
Rajesh
# 2  
Old 09-28-2006
Do you want to capture the HTTP requests and their status?
Try this:
Code:
wget filename_to_get 2>&1|egrep "HTTP|Length|saved"

This will get you your files. You need to do the 2>&1 so that the stderr, where wget writes all this info is routed to stdout. This in turn is piped to the egrep which gives you your output.
# 3  
Old 09-28-2006
you can also use tee command of same

wget filename_to_get | tee out_file |egrep "HTTP|Length|saved"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help in wget or curl command in UNIX shell

Hi, I need help in wget or curl command to invoke a REST client services. This is the format i need to send request wget -H "tokenId: F6" -H "Authorization: Basic <64 bit encoded username:password>" -H "https://example.com" -H "Accept: application/Json" -o download.xml... (1 Reply)
Discussion started by: zen01234
1 Replies

2. Shell Programming and Scripting

Check wget return code

hello check this script it jump to else part, in n both cases, (if files exist or not) wget $MIRROR/kkk.zip && wget $MIRROR/jjj.zip RC="$?" if ] then echo -e "$RED Ooops, Download links are broken...! $RESET" else echo -e "$GREEN Everything is fine, Cheers ... $RESET" fi (4 Replies)
Discussion started by: nimafire
4 Replies

3. Shell Programming and Scripting

Wget to download multiple source code

Can a modified command be used to download multiple source codes from specific sites and output each into a separate output file?. All the sites are in a text file (attached): wget -qO- http://www.genedx.com/test-catalog/available-tests/edar-gene-sequencing/ | cat > output.txt (4 Replies)
Discussion started by: cmccabe
4 Replies

4. Red Hat

Getting the response code and to know whether web site is loaded

Hi Guys, Is there any way that we can know whether a website is fullly loaded with Linux command line ?? is there any command in Linux that can achieve that ?? Also,naturally I would also like to get the response code of the particular website/URL that i am testing for ?? Any help would be... (3 Replies)
Discussion started by: Pradeep_1990
3 Replies

5. Shell Programming and Scripting

WGET command retrying to get response

Hi , Iam using " WGET " command to hit the URL,i.e. servlet url. I can trigger the servlet using wget but when servlet is not responding this command retries automatically until it get the positive response from the server. So this script is running for more than 8 hrs to get the positive... (2 Replies)
Discussion started by: vinothsekark
2 Replies

6. Shell Programming and Scripting

Wget exit code for each line in file

I am trying to validate links inside file if its up or not. Heres what I am trying : #!/bin/bash link='cat url' get=$(wget -q "$link") if then echo "Link not up" else echo "OK" fi $ ./validate ./validate: line 4: Please suggest .. Thanks, (2 Replies)
Discussion started by: sriram003
2 Replies

7. 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

8. Shell Programming and Scripting

Capture http response code from wget

Hi All, I am using wget to call a url..i am getting 202 if it is successful. if not i am forcing the response code to 417. how can i capture the response code and print 0 if it is 202 and 1 if it is not 202 any ideas, please share Thanks, Jack. (2 Replies)
Discussion started by: jack3698
2 Replies

9. 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

10. UNIX for Dummies Questions & Answers

help find wget, less, unzip source code

Where can I find the source code to basic unix core utilities like less, wget, and unzip? I'm on a HP-UX system that is missing a lot of basic tools. I Don't have admin access to the box. Google searches won't give me the source code. I would like to install some of the missing tools, like... (4 Replies)
Discussion started by: goldfish
4 Replies
Login or Register to Ask a Question