I would like to filter the output of a search on ebay which I've exported to a text file. There are a number of results in the search but I've included just one example at the bottom of this post as I presume I'll be able to use the same method to filter all of the results (keeps things neat on here!). I kind of know the basics of filtering out the url using sed and grep, but I would like the output displayed in a specific way. I want the url followed by a comma, then followed by the price. For example:
One thing I will point out at this point is that there are some url's within the text file that are not of use (e.g. http://thumbs.ebaystatic.com/images/g/MEYAAOSwoydWnvT2/s-l225.jpg) but they have a different format to the type i am interested in (i.e. the one I used in the first example). Does anyone know how I can achieve this? Thanks
<h3 class="lvtitle"><a href="http://www.ebay.co.uk/itm/Principles-Of-Modern-Chemistry-International-Edition-Gillis-H-Pat-Oxtoby-Ca-/161952820281?hash=item25b523ec39:g:MEYAAOSwoydWnvT2" class="vip" title="Click this link to access Principles Of Modern Chemistry, International Edition Gillis, H. Pat; Oxtoby; Ca">Principles Of Modern Chemistry, International Edition Gillis, H. Pat; Oxtoby; Ca</a>^M
</h3>^M
<ul class="lvprices left space-zero">^M
^M
<li class="lvprice prc">^M
<span class="bold bidsold">
£73.69</span>
</li>^M
<li class="lvformat">^M
<span >
<span class="logoBin" title="Buy it now"></span>
</span>
grep -n
. 2 using the line numbers from thegrep -n
command, extract that portion into a new file. 3 using cascadedgrep
,sed
andawk
commands, find and extract the URL and the price information. 4 encapsulate the information found with HTML tags and write to a new .html file. – MelBurslan Feb 9 '16 at 20:03grep -n
against those and use the two numbers as the range to yoursed
command. Otherwise, as I said, html is very unpredictable – MelBurslan Feb 10 '16 at 0:11