displaying URLs with lynx -dump

Posted on 2004-10-27
Last Modified: 2011-09-20

I am programming a PHP script in which I need to convert web pages to plain text. Currently, I am using something like this:

$text =`lynx -cfg lcfg.cfg -dump`;

which simply assigns the text dumped by lynx to a variable $text...that is, it is equavalent to doing this from shell:
lynx -cfg lcfg.cfg -dump

this produces the following output:


    Web    [1]Images    [2]Groups    [3]News    [4]Froogle    [5]more »

   Google Search I'm Feeling Lucky   [6]Advanced Search
     [8]Language Tools

    [9]Advertising Programs - [10]Business Solutions - [11]About Google

              ©2004 Google - Searching 4,285,199,774 web pages



This is great, except I would like the URLs to be included in the text itself. For example, instead of  
I would like something like

Does anyone know a command-line flag  or configuration that would let me do something like this with lynx? I am new to lynx, so I may need a little help getting it to work.

Thanks in advance for your help.

Question by:nicholassolutions
    LVL 44

    Accepted Solution

    I don't think this is possible. I'm not aware of any configuration setting or command line option that would do this. w3m (similar functionality as lynx) also does not offer this feature.
    LVL 15

    Author Comment

    Thanks that is kind of what I thought...
    LVL 45

    Assisted Solution

    I too think the same ... however it should be possible to use/modify some existing scripts to get the kind of functionality that you are looking for ... I shall try to post a script later in the day/week

    I think it should be easier to do it using perl ... what do you say khkremer?
    LVL 15

    Author Comment

    Yes, I'd thought of that too...since each link that is referenced appears as e.g. [1]link1, [2]link2, etc., it is not too hard to tack on the links given the references...I was just looking for the "easy way out"...Actually I was concerned about pages containing bracketed numbers confusing my parser, or at least that is my story ;)

    Thanks to both of you for your help -- I'll assign pts shortly.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
    The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
    This video Micro Tutorial is the second in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 ( But the ability to create custom scanning profiles a…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now