Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I got a bunch of URLs (more than 1,000) and I am wondering if there is any CLI script to validate URL for http schema?

share|improve this question
1  
If you google for something like "perl validate url" you will get there... –  Johan Jul 15 '12 at 7:23
    
Thanks. I got this stackoverflow.com/questions/2599047/… and it works as expected. –  Drake Jul 15 '12 at 7:46
    
What do you mean by URL? Are you trying to see if it's well-formed according to RFC1738? Do you want heuristics to detect unencoded space and extra final punctuation? Do you want to know whether the URL points to a reachable web page? –  Gilles Jul 15 '12 at 23:20
add comment

closed as not a real question by Gilles, Renan, Stéphane Gimenez, jasonwryan, jw013 Aug 29 '12 at 18:55

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

up vote 4 down vote accepted

You can use Perl's Regexp::Common::URI::http. From the CPAN documentation:

use Regexp::Common qw /URI/;

while (<>) {
    /$RE{URI}{HTTP}/       and  print "Contains an HTTP URI.\n";
}
share|improve this answer
add comment

Something like egrep "^https?:\/\/" yourlistofurls or do you want to check that that url points to valid http content, too?

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.