Howdy, Stranger!

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

Categories

filtering using lwp-rget

amanceamance Member Posts: 1
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?

(amance3@yahoo.com)

Thanks!
-amance




Comments

  • bgibbybgibby Member Posts: 251
    : 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?
    :
    : (amance3@yahoo.com)
    :
    : 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:)
  • Justin BibJustin Bib USAMember Posts: 0

    _____ | http://forcoder.org | free video tutorials and ebooks about < Assembly, Ruby, PHP, C#, JavaScript, C, Python, Scratch, Java, Perl, Visual Basic .NET, Delphi, Go, MATLAB, Visual Basic, PL/SQL, R, Swift, C++, Objective-C VBScript, Kotlin, Ada, FoxPro, Prolog, SAS, Awk, Rust, Scala, Crystal, Dart, Julia, Clojure, LabVIEW, Bash, Logo, Transact-SQL, Erlang, F#, Lisp, Scheme, Fortran, Apex, ABAP, COBOL, ML, Alice, D, Hack, Lua /> _____________

Sign In or Register to comment.