filtering using lwp-rget

I am using lwp-rget to grab html files but I only want to grab files from urls that contain the word "special" such as these:

www.sitename.com/cgi-bin/article.cgi?file=/c/MN154312.DTL&type=special
www.sitename.com/articles/special/filename.htm

rather than:

www.sitename.com/cgi-bin/article.cgi?file=/c/MN154312.DTL
www.sitename.com/articles/directory/filename.htm

How do I do this?

([email protected])

Thanks!
-amance




Comments

  • : I am using lwp-rget to grab html files but I only want to grab files from urls that contain the word "special" such as these:
    :
    : www.sitename.com/cgi-bin/article.cgi?file=/c/MN154312.DTL&type=special
    : www.sitename.com/articles/special/filename.htm
    :
    : rather than:
    :
    : www.sitename.com/cgi-bin/article.cgi?file=/c/MN154312.DTL
    : www.sitename.com/articles/directory/filename.htm
    :
    : How do I do this?
    :
    : ([email protected])
    :
    : Thanks!
    : -amance
    :
    :
    :
    :
    :

    Hi there,

    If you can get the names of the URLs in a variable then use a Regular Expression Pattern Match to test if it meets your criteria then process it if it does like this...

    [code]

    # Get the URL into a variable
    my $url = ;

    if ($url =~ /special/ig) {
    # Yep, your URL contains the word special
    } else {
    # Nup, your URL doesn't contain the word special
    }

    [/code]

    HTH
    Bradley q:)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion