LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-16-2015, 07:54 AM   #1
rbees
Member
 
Registered: Mar 2004
Location: northern michigan usa
Distribution: Debian Squeeze, Whezzy, Jessie
Posts: 921

Rep: Reputation: 46
can access html data from bash script?


Ladies & Gents,

Thanks for all the help I have been given over the years by people from Linux Questions.

I am working on developing a bash script to schedule events based on the Jewish Holidays. One of those things is to "paly (hebrew) or espeak (english)" the scripture relevent to the holiday (eventually both). Using espeak or some other text-to-speach engine would be much easier if the text can be accessed out of an html file. Otherwise I have to take a text file containing the whole JPS Tanach and generate 500 odd individual text files with the relevent text in each one and such a proccess would be very time consuming.

That said there is a variable ($YOMTOVE) that will contain data like
Code:
Rosh Hashana I,1,Genesis 21:1 - 21:4
I assume that it is possible to take that data and pull the relevent data out of the html flie and hand it to espeak for processing. I just have no idea how to write the code and I don't have any examples to use as a starting place. Can anybody help by pointing me to some sample bash code that does something like this. The simpler it is the more likely that I will understand what it is doing and that is a plus

Thanks

The html sample file
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Genesis 21 / Hebrew Bible in English / Mechon-Mamre</TITLE>
<SCRIPT TYPE="text/javascript" SRC="em.js"></SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<DIV ALIGN="JUSTIFY">
<CENTER>
<TABLE CELLPADDING="10" CELLSPACING="10" WIDTH="100%">
<TR ALIGN="CENTER">
<TD VALIGN=TOP BGCOLOR="#FFFFCC"><P ALIGN=CENTER>
<FONT SIZE="-1">
<A HREF="et0.htm">Bible</A> -
Genesis - <A HREF="et01.htm">All</A><BR>Chapter
<A HREF="et0101.htm">1</A>
<A HREF="et0102.htm">2</A>
<A HREF="et0103.htm">3</A>
<A HREF="et0104.htm">4</A>
<A HREF="et0105.htm">5</A>
<A HREF="et0106.htm">6</A>
<A HREF="et0107.htm">7</A>
<A HREF="et0108.htm">8</A>
<A HREF="et0109.htm">9</A>
<A HREF="et0110.htm">10</A>
<A HREF="et0111.htm">11</A>
<A HREF="et0112.htm">12</A>
<A HREF="et0113.htm">13</A>
<A HREF="et0114.htm">14</A>
<A HREF="et0115.htm">15</A>
<A HREF="et0116.htm">16</A>
<A HREF="et0117.htm">17</A>
<A HREF="et0118.htm">18</A>
<A HREF="et0119.htm">19</A>
<A HREF="et0120.htm">20</A>
21
<A HREF="et0122.htm">22</A>
<A HREF="et0123.htm">23</A>
<A HREF="et0124.htm">24</A>
<A HREF="et0125.htm">25</A>
<A HREF="et0126.htm">26</A>
<A HREF="et0127.htm">27</A>
<A HREF="et0128.htm">28</A>
<A HREF="et0129.htm">29</A>
<A HREF="et0130.htm">30</A>
<A HREF="et0131.htm">31</A>
<A HREF="et0132.htm">32</A>
<A HREF="et0133.htm">33</A>
<A HREF="et0134.htm">34</A>
<A HREF="et0135.htm">35</A>
<A HREF="et0136.htm">36</A>
<A HREF="et0137.htm">37</A>
<A HREF="et0138.htm">38</A>
<A HREF="et0139.htm">39</A>
<A HREF="et0140.htm">40</A>
<A HREF="et0141.htm">41</A>
<A HREF="et0142.htm">42</A>
<A HREF="et0143.htm">43</A>
<A HREF="et0144.htm">44</A>
<A HREF="et0145.htm">45</A>
<A HREF="et0146.htm">46</A>
<A HREF="et0147.htm">47</A>
<A HREF="et0148.htm">48</A>
<A HREF="et0149.htm">49</A>
<A HREF="et0150.htm">50</A>
</FONT></P>
</TD></TR>
</TABLE>
</CENTER>

<H1 ALIGN="CENTER">Genesis Chapter 21</H1>
<A NAME="1"> </A>
<P><B>1</B> And the LORD remembered Sarah as He had said, and the LORD did unto Sarah as He had spoken.
<A NAME="2"> </A>
<B>2</B> And Sarah conceived, and bore Abraham a son in his old age, at the set time of which God had spoken to him.
<A NAME="3"> </A>
<B>3</B> And Abraham called the name of his son that was born unto him, whom Sarah bore to him, Isaac.
<A NAME="4"> </A>
<B>4</B> And Abraham circumcised his son Isaac when he was eight days old, as God had commanded him.
<A NAME="5"> </A>
<B>5</B> And Abraham was a hundred years old, when his son Isaac was born unto him.
<A NAME="6"> </A>
<B>6</B> And Sarah said: 'God hath made laughter for me; every one that heareth will laugh on account of me.'
<A NAME="7"> </A>
<B>7</B> And she said: 'Who would have said unto Abraham, that Sarah should give children suck? for I have borne him a son in his old age.'
<A NAME="8"> </A>
<B>8</B> And the child grew, and was weaned. And Abraham made a great feast on the day that Isaac was weaned.
<A NAME="9"> </A>
<B>9</B> And Sarah saw the son of Hagar the Egyptian, whom she had borne unto Abraham, making sport.
<A NAME="10"> </A>
<B>10</B> Wherefore she said unto Abraham: 'Cast out this bondwoman and her son; for the son of this bondwoman shall not be heir with my son, even with Isaac.'
<A NAME="11"> </A>
<B>11</B> And the thing was very grievous in Abraham's sight on account of his son.
<A NAME="12"> </A>
<B>12</B> And God said unto Abraham: 'Let it not be grievous in thy sight because of the lad, and because of thy bondwoman; in all that Sarah saith unto thee, hearken unto her voice; for in Isaac shall seed be called to thee.
<A NAME="13"> </A>
<B>13</B> And also of the son of the bondwoman will I make a nation, because he is thy seed.'
<A NAME="14"> </A>
<B>14</B> And Abraham arose up early in the morning, and took bread and a bottle of water, and gave it unto Hagar, putting it on her shoulder, and the child, and sent her away; and she departed, and strayed in the wilderness of Beer-sheba.
<A NAME="15"> </A>
<B>15</B> And the water in the bottle was spent, and she cast the child under one of the shrubs.
<A NAME="16"> </A>
<B>16</B> And she went, and sat her down over against him a good way off, as it were a bow-shot; for she said: 'Let me not look upon the death of the child.' And she sat over against him, and lifted up her voice, and wept.
<A NAME="17"> </A>
<B>17</B> And God heard the voice of the lad; and the angel of God called to Hagar out of heaven, and said unto her: 'What aileth thee, Hagar? fear not; for God hath heard the voice of the lad where he is.
<A NAME="18"> </A>
<B>18</B> Arise, lift up the lad, and hold him fast by thy hand; for I will make him a great nation.'
<A NAME="19"> </A>
<B>19</B> And God opened her eyes, and she saw a well of water; and she went, and filled the bottle with water, and gave the lad drink.
<A NAME="20"> </A>
<B>20</B> And God was with the lad, and he grew; and he dwelt in the wilderness, and became an archer.
<A NAME="21"> </A>
<B>21</B> And he dwelt in the wilderness of Paran; and his mother took him a wife out of the land of Egypt. <B>{P}</B></P>
<A NAME="22"> </A>
<P><B>22</B> And it came to pass at that time, that Abimelech and Phicol the captain of his host spoke unto Abraham, saying: 'God is with thee in all that thou doest.
<A NAME="23"> </A>
<B>23</B> Now therefore swear unto me here by God that thou wilt not deal falsely with me, nor with my son, nor with my son's son; but according to the kindness that I have done unto thee, thou shalt do unto me, and to the land wherein thou hast sojourned.'
<A NAME="24"> </A>
<B>24</B> And Abraham said: 'I will swear.'
<A NAME="25"> </A>
<B>25</B> And Abraham reproved Abimelech because of the well of water, which Abimelech's servants had violently taken away.
<A NAME="26"> </A>
<B>26</B> And Abimelech said: 'I know not who hath done this thing; neither didst thou tell me, neither yet heard I of it, but to-day.'
<A NAME="27"> </A>
<B>27</B> And Abraham took sheep and oxen, and gave them unto Abimelech; and they two made a covenant.
<A NAME="28"> </A>
<B>28</B> And Abraham set seven ewe-lambs of the flock by themselves.
<A NAME="29"> </A>
<B>29</B> And Abimelech said unto Abraham: 'What mean these seven ewe-lambs which thou hast set by themselves?'
<A NAME="30"> </A>
<B>30</B> And he said: 'Verily, these seven ewe-lambs shalt thou take of my hand, that it may be a witness unto me, that I have digged this well.'
<A NAME="31"> </A>
<B>31</B> Wherefore that place was called Beer-sheba; because there they swore both of them.
<A NAME="32"> </A>
<B>32</B> So they made a covenant at Beer-sheba; and Abimelech rose up, and Phicol the captain of his host, and they returned into the land of the Philistines.
<A NAME="33"> </A>
<B>33</B> And Abraham planted a tamarisk-tree in Beer-sheba, and called there on the name of the LORD, the Everlasting God.
<A NAME="34"> </A>
<B>34</B> And Abraham sojourned in the land of the Philistines many days. <B>{P}</B></P>
<A NAME="35"> </A>
<CENTER>
<TABLE CELLPADDING="10" CELLSPACING="10" WIDTH="100%">
<TR ALIGN="CENTER">
<TD VALIGN=TOP BGCOLOR="#FFFFCC"><P ALIGN=CENTER>
<FONT SIZE="-1">
<A HREF="et0.htm">Bible</A> -
Genesis - <A HREF="et01.htm">All</A><BR>Chapter
<A HREF="et0101.htm">1</A>
<A HREF="et0102.htm">2</A>
<A HREF="et0103.htm">3</A>
<A HREF="et0104.htm">4</A>
<A HREF="et0105.htm">5</A>
<A HREF="et0106.htm">6</A>
<A HREF="et0107.htm">7</A>
<A HREF="et0108.htm">8</A>
<A HREF="et0109.htm">9</A>
<A HREF="et0110.htm">10</A>
<A HREF="et0111.htm">11</A>
<A HREF="et0112.htm">12</A>
<A HREF="et0113.htm">13</A>
<A HREF="et0114.htm">14</A>
<A HREF="et0115.htm">15</A>
<A HREF="et0116.htm">16</A>
<A HREF="et0117.htm">17</A>
<A HREF="et0118.htm">18</A>
<A HREF="et0119.htm">19</A>
<A HREF="et0120.htm">20</A>
21
<A HREF="et0122.htm">22</A>
<A HREF="et0123.htm">23</A>
<A HREF="et0124.htm">24</A>
<A HREF="et0125.htm">25</A>
<A HREF="et0126.htm">26</A>
<A HREF="et0127.htm">27</A>
<A HREF="et0128.htm">28</A>
<A HREF="et0129.htm">29</A>
<A HREF="et0130.htm">30</A>
<A HREF="et0131.htm">31</A>
<A HREF="et0132.htm">32</A>
<A HREF="et0133.htm">33</A>
<A HREF="et0134.htm">34</A>
<A HREF="et0135.htm">35</A>
<A HREF="et0136.htm">36</A>
<A HREF="et0137.htm">37</A>
<A HREF="et0138.htm">38</A>
<A HREF="et0139.htm">39</A>
<A HREF="et0140.htm">40</A>
<A HREF="et0141.htm">41</A>
<A HREF="et0142.htm">42</A>
<A HREF="et0143.htm">43</A>
<A HREF="et0144.htm">44</A>
<A HREF="et0145.htm">45</A>
<A HREF="et0146.htm">46</A>
<A HREF="et0147.htm">47</A>
<A HREF="et0148.htm">48</A>
<A HREF="et0149.htm">49</A>
<A HREF="et0150.htm">50</A>
</FONT></P>
</TD></TR>
</TABLE>
<P>
<B><A NAME="Mail">Got a question or comment?</A> <SCRIPT TYPE="text/javascript">email('et0121')</SCRIPT></B></P>
</CENTER>
</DIV></BODY></HTML>
 
Old 02-16-2015, 08:06 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,901

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
it is not really simple. here you can find some examples: http://www.unix.com/shell-programmin...g-xmllint.html, but in general you need to find an xml parser to do the job.
 
1 members found this post helpful.
Old 02-16-2015, 03:48 PM   #3
rbees
Member
 
Registered: Mar 2004
Location: northern michigan usa
Distribution: Debian Squeeze, Whezzy, Jessie
Posts: 921

Original Poster
Rep: Reputation: 46
Thanks pan64,

On the plus side libxml2-utils is install which supplies xmllint. On the other hand most of those examples are way beyond what I am able to even start to figure out So it looks like I will be spending some time building the files by hand.
 
Old 02-17-2015, 12:25 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,901

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
yes, actually you are right. But we are here to help you...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash CGI script HTML tags issue m4rtin Programming 1 01-19-2010 12:57 AM
[SOLVED] HTML Form that sends data entered to a bash script as variables simplified Programming 2 12-01-2009 03:35 PM
bash script for adding HTML tags deesto Linux - Newbie 9 03-12-2008 06:40 PM
looking for a perl script to convert html table data into a csv file swiftguy121 Linux - Software 2 04-25-2007 07:28 PM
Bash script for correcting HTML tags hq4ever Programming 4 11-08-2004 04:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration