Results 1 to 4 of 4

Thread: HELP!crontab script displays output differently than command line

  1. #1

    Member Since
    Feb 04, 2012
    HELP!crontab script displays output differently than command line
    hey guys, I was working on setting up a geeklet for my facebook news feeds.

    heres what i am doing

    1. I am running a script from crontab every five min.
    heres the script. all im doing is removing html tags and tabs from the output of curl.

    localhost:geeklets root# cat


    curl --silent " 24.0-540891642"|awk '/pubDate/,/\/description/'|sed 's/^I//g'|sed 's/<[^>]*>//g'|sed 's/\]\]>//g' |sed '/http/d;s/&nbsp;//g'|sed 's/^[^>]*0800$//g'|tr -d " "|fold|cat -s > ${FBLOG}

    if [[ $? -eq 0 ]]; then
    echo "FB logs written!"
    exit 1

    The output of this script has no spaces between words:
    localhost:geeklets root# cat sajal.txt



    Howaboutbeforewegetwastedtonight,wegetwastedtonigh t?Pregame.

    PartyingWithMadhu,Harish,pavaninMalleswaram,Banglo re


    Here’sasecrettoawinningpartyonSunday:placeaDomino’ spre-orderTODAY!


    when i run the curl command from the command line the output(in italics) is flawless (spaces betn words are intact):

    localhost:geeklets root# curl --silent " 9e24.0-540891642"|awk '/pubDate/,/\/description/'|sed 's/ //g'|sed 's/<[^>]*>//g'|sed 's/\]\]>//g' |sed '/http/d;s/&nbsp;//g'|sed 's/^[^>]*0800$//g'|tr -d " "|fold|cat -s

    1Ashwath Gowda Danihalli
    Partying With Madhu , Harish , pavan in Malleswaram,Banglore

    Which Chrome plugins would you recommend?

    Domino's Pizza
    Here’s a secret to a winning party on Sunday: place a Domino’s pre-order TODAY!

    Best Buy
    Take the hassle out of moving your data from your old PC to that shiny new lapto

    Will you be watching the streaming version of Super Bowl XLVI online?

    Sierra Mist
    Superbowl party tomorrow? Try out these festive cocktails for a perfect way to w
    ash down those game day snacks!

    Best Buy
    Thank You to Dreams Come True for choosing Best Buy to fulfill Zowanda's wish fo
    r electronics!

    How can i get the same output from cronning script !

  2. #2

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Hmmm, I can't speak to this issue directly (I am neither a cron or sed expert) but I do know that GeekTool has a refresh function. With that, you can have GT refresh the script at a set interval. Maybe you could try that instead of using cron.

    I also believe cron has been deprecated in OS X with launchd replacing it. It might be worth looking into that as well.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  3. #3

    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Tucson, AZ
    tr -d " " <--- delete character "space"
    This machine kills fascists
    Got # ? phear the command line!

  4. #4

    Member Since
    Feb 04, 2012
    thanks guys.. im stupid.. it was indeed the tr and sed.. i copied and pasted the code. and the ^I(tabs) got transformed to single spaces.

    Silly of me. Sorry to waste you guys time..

    its working perfectly now.

    However i was thinking of refining it some more. i was thinking of making the output of the txt scrollable ie. print lines 0-10, then 11-21 ,.. and so on .. until end of file is reached.
    the code is working on command line (see below) but when i call the script in the geektool, it doesnt show anything. any recommendations?


    localhost:geeklets root# cat

    typeset -i start=1
    end=`wc -l test.txt|awk -F" " '{print $1}'`
    typeset -i end1=$start+10
    echo $start $end $end1

    while [[ $start -lt $end ]]; do
    str="'${start},${end1}p' test.txt"
    echo "sed -n $str"|/bin/ksh
    sleep 1

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Auto Type password for sudo command from crontab
    By aceofsplades in forum macOS - Operating System
    Replies: 1
    Last Post: 09-19-2014, 10:59 PM
  2. Compare OS X command line to Linux command line?
    By V6Pony in forum macOS - Development and Darwin
    Replies: 5
    Last Post: 09-26-2013, 12:32 PM
  3. Terminal command script
    By weasel360 in forum macOS - Apps and Games
    Replies: 5
    Last Post: 08-13-2012, 04:39 PM
  4. Ok, is there a script command to stop...
    By hal515 in forum macOS - Operating System
    Replies: 2
    Last Post: 02-03-2008, 12:53 AM
  5. Remove line from /etc/crontab
    By dstrebel in forum macOS - Operating System
    Replies: 2
    Last Post: 02-21-2006, 01:25 AM

Posting Permissions

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