![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with scheduling a shell script on cygwin using cron | shash | UNIX for Dummies Questions & Answers | 4 | 08-09-2007 06:08 PM |
| problem when the script is scheduled to run as cron job | forumthreads | UNIX for Dummies Questions & Answers | 6 | 07-19-2007 12:27 PM |
| script execute by cron problem, but manual ok | izai | Shell Programming and Scripting | 6 | 06-01-2007 05:45 AM |
| CRON problem using script... | Sorrento | Shell Programming and Scripting | 0 | 10-14-2005 12:48 PM |
| problem with a script and the cron | pascalbout | AIX | 1 | 10-13-2005 09:42 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
I've written a csh shell script to number each line of a file.
Firstly, the program count the number of the file and create a file with number at the front. Then, combine the file together. when i call the program manually, it works.However, when i set it in the cronjob, the output always leaves 3 numeric blank lines. Is there somthing wrong for my program deal with cron job? Thanks for your help. #combine.x #!/bin/csh set ofname=tempa set oftmp=$1 set oname=$1.txt @ count=`more $oftmp | wc -l` @ ll=1 while ( $ll <= $count ) echo $ll"." >> $ofname @ ll++ end set formfile="paste -d "\|" $ofname $oftmp" $formfile > testing.$oname rm $ofname $oftm Manually call output: ( $HOME/combine.x abc.log ) 1.|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ....... 49.|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 50.|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Cron job Output ( 0,15,30,45 * * * * $HOME/combine.x abc.log > /dev/null 2>&1 ) 1.|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ....... 49.|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 50.|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 51.| 52.| 53.| Last edited by fung_donald; 04-11-2002 at 05:45 AM.. |
|
||||
|
Could not get your script to work exactly correct, but did note that the only way I would get extra output is if there were extra lines in the original file - if I put an extra blank line in the first file, then I would get an extra line in the final file. Three extra blank lines, three extra lines in the final file.
Check your data in the original file. There may be either three returns in it or something else causing your problem. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|