Bash – How to output what wget retrieves to stdout and suppress all other wget messaging

bashshell-scriptstdoutwget

I'm using bash shell on Amazon Linux. I have a command in a shell script

wget -O - "http://localhost:8088/subco/books/$e_id/segments/$segment_id?product=$product_id&audience=teacher" > /dev/null

Reading this — https://superuser.com/questions/321240/how-do-you-redirect-wget-to-standard-out/321241, I was led to believe I could output the result of wget (what it retrieves) to my screen and suppress all other output. However instead, what I get is

--2018-05-29 18:39:49--  http://localhost:8088/subco/books/C2644BB08F394E209A26175BD2C89F5A/segments/C2F62E7002964DD396E381DB331129A4?product=D399B9C5F6204EDE80A002930CC0D02F&audience=teacher
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8088... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘STDOUT’

How do I output the result of wget to the screen and suppress all other information (e.g. like the "HTTP request sent, awaiting response… 200 OK" part)?

Best Answer

If you want to use wget, the use -qO -

wget -qO - google.com 

Or you could use curl with no options

curl google.com

And if you want to go a little further and parse results etc, the package BeautifulSoup for Python is great.

Related Question