saving a page using wget+command -O not found+each time i'v to break manually
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
saving a page using wget+command -O not found+each time i'v to break manually
i'm trying to save a page from a university website having results of a student using wget command.
When i run the command from terminal,it saves a file but then it just waits,or the cursor keeps blinking i had to manually break it using "ctrl+c".
What will be the reason? can anyone help me out, my project submission date is next week and this is an important step in it.
Similarly i used to save the page as /root/example.html using option "-O" earlier and it used to work fine,but now it is reporting as command -O not found.
What can be the problem with that.
i'm trying to save a page from a university website having results of a student using wget command.
When i run the command from terminal,it saves a file but then it just waits,or the cursor keeps blinking i had to manually break it using "ctrl+c".
What will be the reason? can anyone help me out, my project submission date is next week and this is an important step in it.
Similarly i used to save the page as /root/example.html using option "-O" earlier and it used to work fine,but now it is reporting as command -O not found.
What can be the problem with that.
Thankyou
The problem is that your URL contains special characters (like '&'), and the shell interprets them in a special way.
Put your URL in quotes or use backslash to escape the characters.
The problem is that your URL contains special characters (like '&'), and the shell interprets them in a special way.
Put your URL in quotes or use backslash to escape the characters.
Thank you.
In terminal it worked.I'm implementing it in java using NETBEANS IDE.
I used the following code
==================================
String cmd ="wget -U MyBrowser/1.0 http://210.212.226.132/exams/results1/btechNEW/BT5555newdisplay.php?regno=mkageit010\\&Submit=Submit";
System.out.println(cmd);
Runtime run = Runtime.getRuntime();
Process pr = run.exec(cmd);
System.out.println(cmd);
BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = "";
while ((line=buf.readLine())!=null) {
System.out.println(line);}
==================================
I had to manually stop the running as it was not getting completed.
What i figured out is that,there is some problem in reading the inputstream.But as i'm beginner in java,i'm unable to understand why ?.
Thank you.
In terminal it worked.I'm implementing it in java using NETBEANS IDE.
I used the following code
==================================
String cmd ="wget -U MyBrowser/1.0 http://210.212.226.132/exams/results1/btechNEW/BT5555newdisplay.php?regno=mkageit010\\&Submit=Submit";
System.out.println(cmd);
Runtime run = Runtime.getRuntime();
Process pr = run.exec(cmd);
System.out.println(cmd);
BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = "";
while ((line=buf.readLine())!=null) {
System.out.println(line);}
==================================
I had to manually stop the running as it was not getting completed.
What i figured out is that,there is some problem in reading the inputstream.But as i'm beginner in java,i'm unable to understand why ?.
I am not a Java guy. Anyway, where from this line:
Code:
while ((line=buf.readLine())!=null)
is supposed to read ?
Please use CODE tags (use "Go advanced" menu option, mark the code with mouse and press '#' button or put the tags manually).
saving a page using wget+command -O not found+each time i'v to break manually
i'm trying to save a page from a university website having results of a student using wget command.
When i run the command from terminal,it saves a file but then it just waits,or the cursor keeps blinking i had to manually break it using "ctrl+c".
What will be the reason? can anyone help me out, my project submission date is next week and this is an important step in it.
Similarly i used to save the page as /root/example.html using option "-O" earlier and it used to work fine,but now it is reporting as command -O not found.
What can be the problem with that.
Thankyou
Is completely misleading as your issue has nothing to do with wget and that you have to terminate with Ctrl+C, but rather that your Netbeans / Java program is
not working and needs to be terminated with Ctrl+C. It may help if you ask your actual question.
I am only mentioning as at the time I originally looked at this question, prior to Sergei's first post, I ran your code and was
about to come back and say it works just fine at my command prompt, but now realise I wasted my time.
Is completely misleading as your issue has nothing to do with wget and that you have to terminate with Ctrl+C, but rather that your Netbeans / Java program is
not working and needs to be terminated with Ctrl+C. It may help if you ask your actual question.
I am only mentioning as at the time I originally looked at this question, prior to Sergei's first post, I ran your code and was
about to come back and say it works just fine at my command prompt, but now realise I wasted my time.
The wget command worked fine when i used backslash in front of the special character.
It was not working as i mentioned in my original query.
And my second question was about the -O option,it used to work fine till last week,now it returned bad command.
And i ran this commands in terminal to check if they are working so that i can implement them in my java project.
But it is not working in my project.
When i press the button to perform the action,it just hangs there and as i mentioned,i think it is stuck when reading from the inputstream
Thankyou
Last edited by Kakarot_Rathish; 04-13-2010 at 04:08 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.