Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parse script not working - Help please

Status
Not open for further replies.

dvknn

IS-IT--Management
Mar 11, 2003
94
US
I have a script-I which calls another script-II and then parses a file and results in a '.csv' file.

script-I (keyword_misses) runs from the 'cron'. The cron entry is:

20 19 * * 00 /opt/TradeOne/bin/keyword_misses >> /var/TradeOne/logs/keyword_misses.out 2>&1


keyword_misses (script code):

#!/usr/bin/ksh -p
#. $HOME/.profile
logs=/var/TradeOne/logs

grep 'NO KEYWORD MATCH' $logs/docdetermination.new >> $logs/NKM.err

if [[ -a $logs/NKM_ERR.csv ]]
then
rm -f $logs/NKM_ERR.csv
elif [[ -a $logs/NKM1_CSV.csv ]]
then
rm -f $logs/NKM1_CSV.csv
fi

nawk -f . /opt/TradeOne/sandbox/garbage/srikanth/genKwdMisses.awk $logs/NKM.err | uniq > $logs/NKM.csv

genKwdMisses.awk (script code)

BEGIN {
FS="[()]"
OFS=","
}

{
split($1, a, " ");
print a[1],$2
}

In keyword_misses script, when I am calling genKwdMisses.awk, I am specifying the 'absolute path' from where it should be invoked. But, when I execute the script, the output file NKM.csv, is empty.

NOW, if I remove the 'absolute path' and execute the script, from the directory location (instead of 'cron', the script works fine and generates an output file).

The 'docdetermination.new' file has data similar to..

2002.12.11 NO KEYWORD MATCH: (saree)
2002.12.11 NO KEYWORD MATCH: (saree)
2002.12.11 NO KEYWORD MATCH: (abc)
2002.12.11 NO KEYWORD MATCH: (abc)
2002.12.12 NO KEYWORD MATCH: (234qwe)
2002.12.12 NO KEYWORD MATCH: (234qwe)


Thanks for reading so much and trying to help me....
 
That is to say...current directory..

I first tried '.nawk -f ./opt/TradeOne/sandbox/garbage/srikanth/genKwdMisses.awk $logs/NKM.err | uniq > $logs/NKM.csv'.

I got an error 'cannot open genKwdMisses.awk'.

So, I separated '.' from the rest of the 'absolute path'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top