The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 09-19-2006
amon amon is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 71
Can anyone find a bug in this code?? shell script

I have done a script and IT WORKS JUST PERFECT from command line...but in cron it has problems executing...

Code:
nawk -F"|" '          
{ s=substr($104,2,18)}
{b[s] ++s}
END { for (i in b) print i, b[i] } ' $1 > /path/to/files/TranId_w$2

q=`cat /path/to/files/TranId_w$2 | wc -l`
echo $q > /path/to/files/forME


nawk -F"|" -v x=$2 -v w=$(cat forME) '
{u=u+1; l=l+$66}
($66 != 0)&&($110 == 1)&&($111 == 0) { a=a+1; s=s+$66}
END { print x"|"u"|"l"|"w"|"s } ' $1 >> statistic



rm /path/to/files/TranId_w$2
rm forME

./ftp_PC statistic
and I execute it ./script1 file1 20061212
I think problem is somewhere in second nawk..becouse in cron I can see TranId_w$2 created every day but statistic is not updated..

can anyone help me with debug??

regards,

Last edited by blowtorch; 09-19-2006 at 03:12 AM.. Reason: add code tags