As a part of Search Engine Optimization (SEO) you may want to be aware of your websites (or clients websites) page rank on Google. After some researching I’ve found the following solutions to be best. I’ll be presenting a few options here, first we’ll cover how to look it up on prchecker.info. Second we’ll be covering how to look up the page rank using a perl script and finally we’ll cover how to look up your page rank with the perl script and update a mysql database with the information (for long term tracking and/or tracking multiple websites.)
READ MORE »
Posts in category Perl
Web Dev> Obtaining Google PageRank
Perl> Useful one-liners
Remove string from file
perl -ni -e 'print unless /pattern/' /path/to/filename
Replace string with string
perl -p -i -e 's/PATTERN/NEW_ENTRY/g' /path/to/filename
Insert string where delimeter is found
This will replace the original delimiter with the new entry and then add the delimiter so you can use it again in the future.
perl -p -i -e 's/DELIMETER/NEW_ENTRY\n\nDELIMETER/g' /path/to/filename
This will grab anything thats in the standard IPv4 format (anything! not always IPs…but usually).
perl -ne 'print "$&\n" while m#\d+\.\d+\.\d+\.\d+#g' file.txt
Search for and find whole paragraphs containing $string
perl -00ne "print if /$string/i" < file.txt
Perl> Get IP only from logfiles
Being an ISP admin, I have regular need to find IP addresses listed in large logfiles. The following will grab anything that appears to be an IP and list it out for you, from there you can sort or whatever you want to do with the list.
perl -ne 'print "$&n" while m#d+.d+.d+.d+#g' <logfile>
Or just throw it in a bash script for easier remembering:
getip.sh
#!/bin/bash perl -ne 'print "$&\n" while m#\d+\.\d+\.\d+\.\d+#g' $1;