Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
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....
  1. #1
    Just 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.

  2. #2
    Linux 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

  3. #3
    Just Joined!
    Join Date
    Jul 2007
    Posts
    59
    Quote Originally Posted by Franklin52 View Post
    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

    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?

  4. #4
    Just Joined!
    Join Date
    Jul 2007
    Posts
    59
    Quote Originally Posted by Franklin52 View Post
    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



    I got the details here but could any1 help mi plz??? Meeting deadline soon ..OH NO!!!!

  5. #5
    Just Joined!
    Join Date
    Jul 2007
    Posts
    59
    Quote Originally Posted by Franklin52 View Post
    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

    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

  6. #6
    Linux User
    Join Date
    Aug 2006
    Posts
    458
    provide a sample of that web page and the header you want to get.

  7. #7
    Just Joined!
    Join Date
    Jul 2007
    Posts
    59
    Quote Originally Posted by ghostdog74 View Post
    provide a sample of that web page and the header you want to get.
    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 ?

  8. #8
    Linux 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.

  9. #9
    Just 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. #10
    Just Joined!
    Join Date
    Jul 2007
    Posts
    59
    Quote Originally Posted by ghostdog74 View Post
    sorry can't help, unless you post a sample, and describe what you want to get from that sample. easier this way.
    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">&nbsp;</td>
    </tr>
    <tr>
    <td width="5" valign="top">&nbsp;</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 &raquo; </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) ?

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...