Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Why doesn't this work?:
wget -q -U Mozilla "http://rss.slashdot.org/Slashdot/slashdot" -O - | tr '\n' ' '

p.s.: and under openwrt 10.03:
# wget "http://slashdot.org/" -O -
Connecting to slashdot.org (216.34.181.45:80)
wget: bad header line: slash_LOG_DATA: shtml
$

share|improve this question
2  
The tr '\n' ' ' has nothing to do with it. wget is getting an error when trying to download the file. –  Wuffers Jan 22 '11 at 16:54
    
wget -q -U Mozilla "http://slashdot.org/" -O - | tr '\n' ' ' works perfectly for me –  Nifle Jan 23 '11 at 10:44
    
What error does wget -q -U Mozilla "http://rss.slashdot.org/Slashdot/slashdot" -O - give? What is your expected result of doing that whole command with tr and what do you get instead? –  Tom Wijsman Jan 24 '11 at 22:06
add comment

2 Answers

wget "http://slashdot.org/" -O -

 

HTTP/1.1 200 OK  
Server: Apache/1.3.42 (Unix) mod_perl/1.31  
SLASH_LOG_DATA: shtml  
...

wget performs bad on the third line of the header, seems like a bug to me. I would suggest reporting it.

Furthermore, I would suspect that site to act weird as they are using old standards...

share|improve this answer
add comment

This still happens and isn't a fault or bug. The wget command will create a file - whether you download something or not. So the second time you issue the same command the file is already there.

This happens for instance when you use wget in a BeagleBone to pass weather info to your website for logging purposes:

eg.:

wget "http://www.mysite.com/tempinfo.php?temp=15"

*NOTE: (Filename starts with first letter after the last "/" and ends with last letter or first blank)

This will run OK the first time but the second time it will produce named error because wget tries again to create a file with the name "tempinfo.php?temp=15".

What you could do is (re)direct the dummy file to dummy output ;-)

So the proper command in this case would be:

wget "http://www.mysite.com/tempinfo.php?temp=15" -O /dev/null
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.