I want to search a text file which has xml content of top 10 results returned by google. each result has the folllowing information. <url><tilte><snippet> wat i want to do is in a perl program get the same query which i given to search in google and compare that query with all 10 result "title". The one title that matches exactly should be move to top along with its associated infor. the next matching in 2nd position. Like that i want to compare the query string and sort the text file.
for eg. the file will look some thing like this.
<?xml version="1.0" encoding="utf-8"?> <resultslist> <results> <result> <url>http://www.google.com/research/pubs/archive/32686.pdf</url> <title>Effectively finding relevant web pages from linkage information + ...</title> <snippet>AbstractâThis paper presents two hyperlink analysis-based alg +orithms to find relevant pages for a given Web page (URL). The first< +/snippet> </result> </results> </resultlist>
here in this only 1 result and its associated contents i included. like that 9 more results are there. So, in this file i have to search for specific string inputted through eg.pl program and search in each title in the result. According to that i want to resort the file.. I mean the most exact match and its associated contents should be in first. the next at second.. etc
In reply to how to search a text file using perl cmd line program by sarvan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |