The following program works fine, EXCEPT I get residue on the screen. I appear to me as the command line variables being passed to AWK:
Program below:
#!/usr/bin/ksh
#===========================================================
# Needed for CRON (refreshes profile)...
#===========================================================
conORACLE_SID=`/usr/ucb/whoami | tr '[:lower:]' '[:upper:]'`
. /opt/clarify/$conORACLE_SID/.profile
#===========================================================
# Declarations...
#===========================================================
conCOMMAND_DIRECTORY="/usr/xpg4/bin"
strTimeStamp=`date '+_%y%m%d_%H:%M:%S'`
strINPUT_FILE="/opt/clarify/$conORACLE_SID/$1/log_files/stress/stress_$1.txt"
strOUTPUT_FILE="/tmp/stress_$1$strTimeStamp.txt"
$conCOMMAND_DIRECTORY/awk -v output_file=$strOUTPUT_FILE '
BEGIN {
x = 1
}
{
if (substr($0,1,1) == "\""
{
print $0 > output_file
}
else
{
if (x > ARGV[2])
{
print $0 > output_file
}
x++
}
}
' $strINPUT_FILE $2
Output from program:
/opt/clarify/scripts[CRMS]:-> strrefresh1.ksh cntc_rxr 10
input file "10"/opt/clarify/scripts[CRMS]:->
My question is, where does the text (input file "10" come from?
Thanks
Program below:
#!/usr/bin/ksh
#===========================================================
# Needed for CRON (refreshes profile)...
#===========================================================
conORACLE_SID=`/usr/ucb/whoami | tr '[:lower:]' '[:upper:]'`
. /opt/clarify/$conORACLE_SID/.profile
#===========================================================
# Declarations...
#===========================================================
conCOMMAND_DIRECTORY="/usr/xpg4/bin"
strTimeStamp=`date '+_%y%m%d_%H:%M:%S'`
strINPUT_FILE="/opt/clarify/$conORACLE_SID/$1/log_files/stress/stress_$1.txt"
strOUTPUT_FILE="/tmp/stress_$1$strTimeStamp.txt"
$conCOMMAND_DIRECTORY/awk -v output_file=$strOUTPUT_FILE '
BEGIN {
x = 1
}
{
if (substr($0,1,1) == "\""
{
print $0 > output_file
}
else
{
if (x > ARGV[2])
{
print $0 > output_file
}
x++
}
}
' $strINPUT_FILE $2
Output from program:
/opt/clarify/scripts[CRMS]:-> strrefresh1.ksh cntc_rxr 10
input file "10"/opt/clarify/scripts[CRMS]:->
My question is, where does the text (input file "10" come from?
Thanks