learningperl01 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use File::Find; find(\&url_find, "/tmp/sub_url_test/"); sub url_find() { if ( -f && \.txt$) { #Find files ending in .txt open(LOG, "< $File::Find::name") or return(0); while ( my $LINE = <LOG> ) { if ( $LINE =~ m/(http:\S*\s)/ ) { print $LINE; } } } } ============== FILE CONTENTS ============== This is a test this is a test test test http://www.website. com/getme.html this is test this is a test This is a test this is a test test test http://www.website2.com/ getme.html this is test this is a test This is a test this is a test test test http://www.website3.com/getme .html this is test this is a test This is a test this is a test test test http://www.website4.com/getme. +h tml this is test this is a test ============== CURRENT OUTPUT ============== This is a test this is a test test test http://www.website. This is a test this is a test test test http://www.website2.com/ This is a test this is a test test test http://www.website3.com/getme This is a test this is a test test test http://www.website4.com/getme. +h ============================== OUTPUT THAT I AM HOPING TO SEE ============================== http://www.website.com/getme.html http://www.website1.com/getme.html http://www.website2.com/getme.html http://www.website3.com/getme.html http://www.website4.com/getme.html
|
|---|