5
Lets say I have a sitemap.xml
file with this data:
<url>
<loc>http://domain.com/pag1</loc>
<lastmod>2012-08-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>http://domain.com/pag2</loc>
<lastmod>2012-08-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>http://domain.com/pag3</loc>
<lastmod>2012-08-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
I want to extract all the locations from it (data between <loc>
and </loc>
).
Sample output be like:
http://domain.com/pag1
http://domain.com/pag2
http://domain.com/pag3
How to do this?
What OS are you using? – bobmagoo – 2012-08-27T11:35:50.347
Windows 7 Ultimate X64 / Windows 8 Pro X64 or Ubuntu 12.04 Linux. – Akshat Mittal – 2012-08-27T13:13:12.773
Nice setup. Using Terminal on the Ubuntu box, my answer below will get you what you need.
– bobmagoo – 2012-08-27T13:22:39.727You can also use any text editor like SublimeText2 which can use regexp, you can get all data with it, or you can use python see my answer below. – Ishikawa Yoshi – 2012-08-27T14:35:46.487