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.|