The curl util will do that for you:
http://curl.haxx.se/ is where you can D/L it. There's a binary version for Mac OS X so you dont' have to compile it yourself. It's also in fink, probably darwin ports too.
Once you have it installed, You can do something like:
[rwhiffen:~] rwhiffen% curl -I
http://whiffen.org
HTTP/1.1 200 OK
Date: Tue, 09 Aug 2005 13:57:03 GMT
Server: Apache/1.3.33 (Unix) FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7d PowWeb/1.1
Last-Modified: Mon, 08 Aug 2005 03:05:06 GMT
ETag: "305aeb1-167d-42f6cbe2"
Accept-Ranges: bytes
Content-Length: 5757
Content-Type: text/html
[rwhiffen:~] rwhiffen%
You can use grep to get just the line you need:
[rwhiffen:~] rwhiffen% curl -sI
http://whiffen.org | grep "Last-Modified"
Last-Modified: Mon, 08 Aug 2005 03:05:06 GMT
[rwhiffen:~] rwhiffen%
Further, cut can be used to trim it even more:
[rwhiffen:~] rwhiffen% curl -sI
http://whiffen.org | grep "Last-Modified" | cut -b16-80
Mon, 08 Aug 2005 03:05:06 GMT
[rwhiffen:~] rwhiffen%
You can assign that to a variable if you need to:
[rwhiffen:~] rwhiffen% setenv LAST_MOD `curl -sI
http://whiffen.org | grep "Last-Modified" | cut -b16-80`
[rwhiffen:~] rwhiffen% echo $LAST_MOD
Mon, 08 Aug 2005 03:05:06 GMT
[rwhiffen:~] rwhiffen%
The ` is the quote above the tab key with the ~ char.
Cheers,
Rich