I have an HP PPM (ITG) application that is running an awk command in cygwin bash shell as part of ITG process moving SAP transports on a Windows 2003 server. The awk command checks the first two characters of a file containing return code that was retrieved from the SAP server. It is throwing the error "invalid character ' in expression" . The following is the log:
sent command:
bash-2.05$ cat imp_619015_5.txt; echo KSC_EXIT_STATUS $?
received echo:
cat imp_619015_5.txt; echo KSC_EXIT_STATUS $?
00#!#Successful, Return Code: 00
KSC_EXIT_STATUS 0
sent command:
bash-2.05$ returncode=`cat imp_619015_5.txt | awk '{printf substr($1,1,2)}'`; echo KSC_EXIT_STATUS $?
received echo:
returncode=`cat imp_619015_5.txt | awk '{printf substr($1,1,2)}'`; echo KSC_EXIT_STATUS $?
awk: cmd. line:1: {printf substr($1,1,2)}
awk: cmd. line:1: ^ Invalid char ' in expression
KSC_EXIT_STATUS 2
Command: [returncode=`cat imp_619015_5.txt | awk '{printf substr($1,1,2)}'`] did not complete successfully.
Aborting command execution.
Closing telnet session.
Errors occurred during command execution.
When I run the awk command in the command line in the bash shell on the server and echo the returncode variable, it returns "00" as expected. Not sure why it is failing in ITG. Rebooting the server seems to solve the problem temporaraly but the problem comes back after a few days. Anyone have another way to run this command that I could try? Any ideas what could be causing the error? I do not have much experience in unix scripting.