Results 1 to 10 of 18
Anyone please help me...im writing a bash script using cron , the script have to grep the headline of the website and update to messaging system everyday....
- 08-31-2007 #1Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
Need help in scripting
Anyone please help me...im writing a bash script using cron , the script have to grep the headline of the website and update to messaging system everyday.
- 08-31-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Hi,
I think you need to provide further information: what are the lines you want to grep and what should be the output?
What have you done to attempt to solve this problem yourself?
Post your sample script, and we'll see how we can assist.
Regards
- 09-04-2007 #3Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
ok, i need to grep some news from the channel new asia websites, and by using cron and writing a script, i have to sent the news grep everyday up to the wireless message system. The lines are the heading from channal new asia singapore news.
i wrote this script ..dun noe correct a not..
#!bin/bash
#
#myscript.sh
shopt -s -o nounset
declare -rx SCRIPT=${0##*/}
for news1.txt in *
do
myscript = echo "$news1.txt" | grep header | head -3 | sed 's/<[^<>]*>// g' | tail -1
$myscript >/dev/null
done
exit0
any1 enlighten me plz?
- 10-08-2007 #4Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
- 10-08-2007 #5Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
Hey guys this is wat i got here..does it works ?
#!bin/bash
#
#myscript.sh
shopt -s -o nounset
declare -rx SCRIPT=${0##*/}
for news1.txt in *
do
myscript = echo $grep "header" | head -3 | sed 's/<[^<>]*>//g ' |tail -1 /home/user/news1.txt
$myscript >/dev/null
done
exit0
- 10-08-2007 #6Linux User
- Join Date
- Aug 2006
- Posts
- 458
provide a sample of that web page and the header you want to get.
- 10-15-2007 #7Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
I wan 2 grep something from channelnewsasia.com, i already save the source code into a txt file using curl_http://channelnewsasia.com/singapore/index.htm > news.txt, ok now i got the txt file, and i want to grep the headlines under the top story, i think the command i got here is, cat news1.txt | grep header | head -3 | sed 's/<[^<>]*//g ' |tail -1 . how do i write the script to tell him to grep out the headlines automatically , combining it with cron ?
- 10-15-2007 #8Linux User
- Join Date
- Aug 2006
- Posts
- 458
sorry can't help, unless you post a sample, and describe what you want to get from that sample. easier this way.
- 10-18-2007 #9Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
I got the text file here. i post it here? and u help me solve my problems?
- 10-26-2007 #10Just Joined!
- Join Date
- Jul 2007
- Posts
- 59
Can any1 help me create a script that can grep news headlines from a chunk of source code by writing a script.
The part of the source code i wan is below, the headline i wan is Singapore to put in better bid to host Youth Olympic Games
Can any1 help me please, i really need help .... HELP!!!!!
This is the source code,
</tr>
</table></td>
</tr>
</table>
<table width="596" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="26" colspan="3"> </td>
</tr>
<tr>
<td width="5" valign="top"> </td>
<td width="256" valign="top"><span class="subheader">top story</span>
<table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="/stories/singaporelocalnews/view/304401/1/.html"><img src="/imagegallery/store/phpMUfPSL.jpg" alt="PM Lee Hsien Loong" border=0 align="right"></a></td>
</tr>
<tr>
<td class="hpHeader"><img src="shim.gif" width="5" height="6"/></td>
</tr>
<tr>
<td class="header">Singapore to put in better bid to host Youth Olympic Games </td>
</tr>
<tr>
<td height="20" class="update">Posted : 08 Oct 2007 0218 hrs</td>
</tr>
<tr>
<td class="bodytext"><?xml version="1.0"?><article>
<body><page>Singapore now has a greater understanding of the requirements for the Youth Olympic Games, and will put in a better bid to host the event.</page></body></article><br />
<a href="/stories/singaporelocalnews/view/304401/1/.html">Full Story » </a></td>
</tr>
</table>
<br />
<script language=javascript>displayAd("www.channelnewsasia .com/singapore","Position2")</script>
<br />
</td>
<td width="335" valign="top">
Any1 help me create a script that can grep the headlines (above) ?


Reply With Quote
