catch the output of the URL

Hi all,

anybody can help me in this?

how to catch the output of the URL in scripting.
exmple:
if i give the URL:
http://www.unix.com/shell-programming-scripting/155750-use-sed.html\#post302503291
then output should be in onefile newfile.txt

thanks in advance..

try this

wget http://www.unix.com/shell-programming-scripting/155750-use-sed.html#post302503291 > newfile.txt

Do u need the status of the url???

wget -O newfile.txt "http://www.unix.com/shell-programming-scripting/155750-use-sed.html#post302503291"

Notes:

  1. It's better to quote the string to avoid bad interpretation by the shell.
  2. The "http://" is subsidiary for wget.

Hi Homebo and frans,

i tried with your codes but it is throwong error.
wget http://www.unix.com/shell-programming-scripting/155750-use-sed.html\#post302503291 > newfile.txt
error: wget: not found
wget -O newfile.txt "http://www.unix.com/shell-programming-scripting/155750-use-sed.html\#post302503291"
error: wget: not found

clearly,you need to install wget,if you use ubuntu,you can install it by

sudo apt-get install wget

Installation's similarly in other distributions.

curl is another tool you can use to retrieve the contents of a URL.