Article 5JFMB Get XML, parse output, get a date and calculate differences?

Get XML, parse output, get a date and calculate differences?

by
riahc3
from LinuxQuestions.org on (#5JFMB)
Hello

I know very little bash so hang with me here.

I want to read a URL that returns XML from bash. It returns something like this:

<response status="success">
<result>
<entry name="hello">
<name>hello</name>
<a-valid-date>May 3 07:00:00 2031 GMT</a-valid-date>
</entry>
</result>
</response>

My only real intrest is "a-valid-date" I want to get that value and work with it: If today is 30 days or less away from it, I return something. If today is more than 30 days AND less than 60 days away from it, I return something else. If today is more than 60 days, I return something else.

I imagine I have to do something with grep, maybe a loop, etc but other than that, I dont know what to do, sorry.

Can someone help me out?

Thankslatest?d=yIl2AUoC8zA latest?i=viZg56W-pJk:4nNecrWgbTE:F7zBnMy latest?i=viZg56W-pJk:4nNecrWgbTE:V_sGLiP latest?d=qj6IDK7rITs latest?i=viZg56W-pJk:4nNecrWgbTE:gIN9vFwviZg56W-pJk
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments