1

I am looking to extract text from an html using Applescript, here is the code:

<div class="vk_bk vk_ans">3:27 PM</div> 

I want to extract "3:27 PM" which is the result google gives you when you ask the time in New York. Google will always give you a direct result between those tags and i am looking to extract it and once extracted exported to a .txt. If you guys need more of the HTML just search time in New York and inspect the element.

All answers are appreciated.

1 Answer 1

0

Probably it's easy to extract using sed command on the terminal.

sed -E 's/<div class="vk_bk vk_ans">(.*)<\/div>/\1/g' filename

This will return you the text between <div class="vk_bk vk_ans"> and </div> that exists on your filename.

1
  • I copied and pasted all of the html onto a .txt file and enter the command you told me on terminal which is: sed -E 's/<div class="vk_bk vk_ans">(.*)<\/div>/\1/g' test.txt. but i get all of the html back once i inserted the command. Please Help!
    – Alec Attie
    Apr 26, 2015 at 18:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .