Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to extract one field to my local PC from an online form.

I can save the page locally as text document and then search for the text but this seems rather cumbersome. Is there another more efficient method?

My background is on Macs but the company is trialling PC's using Ubuntu 12.04, so please be tolerant of my relevant ignorance.

share|improve this question
This sounds like a job for wget and perl. – cauon Oct 21 '12 at 9:22
by "extract one field", do you mean extracting its value, or the actual HTML tag (e.g. <input type="text" value="0" />)? either way, this question seems like a better fit down at – Eliran Malka Oct 21 '12 at 10:05

You're looking for tools like

wget -q -O - ''

curl -s ''

lynx -dump ''

And then you can extract what you want with the usual, sed, awk ..

It'd have helped if you said what page and what to extract.

share|improve this answer

Im not 100% sure I understand what you really need, but you could get the HTML source directly in the browser.

If you are using firefox you can do a lot of fancy stuff right in the browser.

  • Right click in the page -> View Page Source (Alternative would be to press ALT and search for source in the HDU)
  • Hightlight the part of the page you want the source for -> Right Click -> View Selection Source

If this is not enough, you got a lot of addons for firefox that lets you fool around with the HTML =)

If this is a high volume job, you might need some script to get the job done however (download, use perl or something that supports regular expression to search, extract). But if you just need to do it once in a while, the firefox methods might be enough?

Did I understand the question correctly?

share|improve this answer
I know of the add-ons that might be suitable, but I'd rather not use any manual intervention; my preference is for a single script based solution. Do you know how I could save my current view page using a terminal instruction? – user99467 Oct 21 '12 at 10:52
I have look around a bit, and such a command seems not to be possible to use. It was possible before, with -remote "saveAs()", but this has been removed. Another possible way to handle this would perhaps to use xdotool to automatically save the current page as html. If you wrote a xdotool script that got invoked from another script that parsed and extracted your information. This is ofcourse a bit tidous xD But there does not seem to be many other options at this time. – Gjermund Bjaanes Oct 21 '12 at 13:13

Your Answer


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.