Zolf
asked on
count and sort url in text file
hello there,
i have this code which gets all the url from a text file.now i want to also get the number of times that url is in the text file and then sort them according to their numbers.
for example
https://www.experts-exchange.com 50
http://www.gmail.com 44
http://www.yahoo.com 40
cheers
zolf
i have this code which gets all the url from a text file.now i want to also get the number of times that url is in the text file and then sort them according to their numbers.
for example
https://www.experts-exchange.com 50
http://www.gmail.com 44
http://www.yahoo.com 40
cheers
zolf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you are on a unix system, you can do:
sort file | uniq -c | sort -rn
sort file | uniq -c | sort -rn
ASKER
no i am not
ASKER
#!/usr/bin/perl
@arr = <IN>;
foreach $i (@arr)
{
@arr1 = split('\s+',$i);
foreach $j (@arr1)
{
if($j =~ /^http:\/\/(.*)$/ig)
{
print $j."\n";