The UNIX and Linux Forums  


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



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
c shell script help with find bigboizvince Shell Programming and Scripting 1 03-25-2008 03:49 PM
How to embed shell script in a awk code rajbal Shell Programming and Scripting 8 09-28-2006 05:19 PM
Capture Oracle return code in shell script Vikas Sood Shell Programming and Scripting 1 05-22-2006 06:32 PM
Store return code of shell script in oracle table sveera Shell Programming and Scripting 3 05-04-2005 02:25 PM
Hide code in shell script??? alan Shell Programming and Scripting 11 08-02-2003 12:33 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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
  #2 (permalink)  
Old 09-19-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
I think your problem may lie in the "cat forME" in the second nawk. Try giving a full path for that. Give a full path for that ftp_PC file as well.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:16 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0