how to use WGET command to get today's date?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to use WGET command to get today's date?
# 1  
Old 04-21-2011
how to use WGET command to get today's date?

I need to get the current date off a remote site, such as Google or Yahoo.
Does anyone know how to use the wget command on a Solaris 10 system to do this? I recall a long time ago, where using "wget" will get a bunch of info off a site, and then, you can extract the date from all of that info.

This is what I tried, and it doesn't work:


/usr/sfw/bin/wget yahoo dot com (I can't paste the link here)
# 2  
Old 04-21-2011
Code:
wget --server-response  --spider http://www.yahoo.com

Code:
--09:51:03--  http://www.yahoo.com/
           => `index.html.1'
Resolving www.yahoo.com... 87.248.122.122, 87.248.112.181
Connecting to www.yahoo.com|87.248.122.122|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.0 302 Found
  Date: Thu, 21 Apr 2011 07:51:03 GMT
  P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
  Cache-Control: private
  Set-Cookie: IU=deleted; expires=Wed, 21-Apr-2010 07:51:02 GMT; path=/; domain=.yahoo.com
  Set-Cookie: fpc=d=QYjtE9OdzrgTsvj2ZSHAEUysiGpvBxV3CwVfI_Hd9MLrnBm4W85EufcBK1Pt7LShjT_IohviXXHc_cajJZpV8_0Ecz8Dtdau57X4D40rdTyFKdkwZM4Xj82uYBAUy6Xmf.P5jmvFf90OF8CkKYEgSge.kGeJo7dVkxgCis_dTY82tv8dmuB3cBQIf5ByexRUht39qyk-&v=2; expires=Fri, 20-Apr-2012 07:51:03 GMT; path=/; domain=www.yahoo.com
  Location: http://de.yahoo.com/?p=us
.......

i think curl may do that better, at least without so many overheads.

Code:
curl --head http://yahoo.com
HTTP/1.1 301 Moved Permanently
Date: Thu, 21 Apr 2011 07:52:39 GMT
Location: http://www.yahoo.com/
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8
Cache-Control: private
Age: 0
Connection: keep-alive
Server: YTS/1.20.0

# 3  
Old 04-21-2011
Thanks for your response. This is what I see when I run the wget command on my Solaris 10 system. It's linked to a network that has Internet access.


--10:22:21-- Yahoo! Ireland
=> `index.html'
Resolving www.yahoo.com... failed: node name or service name not known.



How do I configure my Solaris 10 so that it can use wget to communicate to the outside world? Thanks.
# 4  
Old 04-21-2011
It's not wget that's having problems. Your system can't look up domain names. What's in /etc/resolv.conf ?
# 5  
Old 04-21-2011
That file doesn't even exist.
# 6  
Old 04-21-2011
Can you ping an ip address?

Code:
ping 66.82.4.8

# 7  
Old 04-22-2011
I am closing this thread as the OP has opened another thread on their network connection issue.

See how to link x86 Solaris 10 system to the Internet?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Compare Date to today's date in shell script

Hi Community! Following on from this code in another thread: #!/bin/bash file_string=`/bin/cat date.txt | /usr/bin/awk '{print $5,$4,$7,$6,$8}'` file_date=`/bin/date -d "$file_string"` file_epoch=`/bin/date -d "$file_string" +%s` now_epoch=`/bin/date +%s` if then #let... (2 Replies)
Discussion started by: Greenage
2 Replies

2. Shell Programming and Scripting

Help Needed for creating the folder by checking today's date and, take backup using rsync command

How to create a shell script to create a folder by using the today's date to take backup using rsync command on every evening around 7 pm. Kindly help. Thanks. To be more precise, I want to create a script which matches the today's date with server's date format, if matches then creates the... (2 Replies)
Discussion started by: bakula10
2 Replies

3. Shell Programming and Scripting

Check, if date is not today

hello, in a file exist entries in date format YYYYMMDD. i want to find out, if there are dates, which isn't today's date. file: date example text 20140714 <= not today's date 20140715 <= not today's date 20140716 <= today's date my idea is to use Perderabo's datecalc ... (2 Replies)
Discussion started by: bora99
2 Replies

4. Shell Programming and Scripting

Need to add a date column (today's date) in file

Hi I have file with number status and date1 and date1 field, want add a column today between column date1 and date2. file1.txt number status date1 date2 ===== ==== === ===== 34567 open 27/06/13 28/06/13 45678 open 27/06/13 28/06/13 43567 open 27/06/13 28/06/13 ... (1 Reply)
Discussion started by: vijay_rajni
1 Replies

5. Shell Programming and Scripting

UNIX date fuction - how to deduct days from today's date

Hi, One of my Unix scripts needs to look for files coming in on Fridays. This script runs on Mondays. $date +"%y%m%d" will give me today's date. How can I get previous Friday's date.. can I do "today's date minus 3 days" to get Friday's date? If not, then any other way?? Name of the files is... (4 Replies)
Discussion started by: juzz4fun
4 Replies

6. Shell Programming and Scripting

[Solved] Replace yesterday date with today's date except from the first line

Hello, I have a file like this: 2012112920121130 12345620121130msABowwiqiq 34477420121129amABamauee e7748420121130ehABeheheei in case the content of the file has the date of yesterday within the lines containing pattern AB this should be replaced by the current date. But if I use... (3 Replies)
Discussion started by: Lilu_CK
3 Replies

7. Shell Programming and Scripting

Today's date using Perl?

Easiest way to get it in the form of MM/DD/YY for Perl 5.8.8? Thanks (4 Replies)
Discussion started by: stevensw
4 Replies

8. Shell Programming and Scripting

Grep out only today's date

Hi, I have some log files. I've been asked to grep out error messages that have happened ONLY today. (However, the logs keep messages a long time so they have error messages going back weeks) They log details in these fields (order): Month Day Time Server message I can grep out the... (8 Replies)
Discussion started by: horhif
8 Replies

9. UNIX for Dummies Questions & Answers

Shell Scripts - shows today’s date and time in a better format than ‘date’ (Uses positional paramete

Hello, I am trying to show today's date and time in a better format than ‘date' (Using positional parameters). I found a command mktime and am wondering if this is the best command to use or will this also show me the time elapse since 1/30/70? Any help would be greatly appreciated, Thanks... (3 Replies)
Discussion started by: citizencro
3 Replies

10. UNIX for Dummies Questions & Answers

compare today's date with date in a file

Hi I am very new to scripting, Can someone show me how to (in unix shell script) compare the system's date with a date in a file. The requirement is to somehow open this file (which will only have a date in it) and compare it with today's date. If they are equal execute a procedure below but if... (4 Replies)
Discussion started by: siog
4 Replies
Login or Register to Ask a Question