Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 am trying to run an incremental search using lynx.

Imagine a page, for example, an index_of page which contains several folders which also contain other subfolders and files. I want to run lynx in a way that I can enter automatically in each folder/page and search for a string, so it returns me the link which contains the string found.

For example, if I am looking for a specific datasheet in http://datasheets.chipdb.org/ so I would try something like

find . -name "mydatasheet.pdf" |lynx -dump http://datasheets.chipdb.org

but that I could run in all subfolders recursively. Maybe some grep or whatever.

How could it be done?

share|improve this question
Isn't lynx a text based browser? How can it do an incremental search? – Ketan Feb 13 '14 at 23:13
Well, that's exactly the question. But you can identify the links based on a link pattern. – Rego Feb 13 '14 at 23:16
up vote 0 down vote accepted

Maybe I don't understand your question but if I were trying to find a link to a pdf file I would write a python script. Something like:

#!/usr/bin/env python

import urllib2
import re
from bs4 import BeautifulSoup
def find_links ( url ):
                soup = BeautifulSoup(urllib2.urlopen( url ).read())
        links = soup.findAll( "a" )
        for link in links:
                pdfurl = link.get('href')
                m = re.search( "^\?", pdfurl)
                if m:
                m = re.search( ".pdf$", pdfurl)
                if m:
                        print "Found a pdf in %s/%s" % (url, pdfurl)
                        find_links( "%s/%s" % ( url, pdfurl) )

find_links( "http://datasheets.chipdb.org" )

Or a Perl script that uses WWW::Mechanize.

share|improve this answer
Yes, that's something like this. Thanks! – Rego Feb 15 '14 at 2:06

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.