Hi All,
I'm new to shell scripting. Trying to extract substring using awk script as shown below :
Flag=$1
Length=`echo ${#Flag}`
NewLen=$Length-2
NewFlag=`echo $Flag|awk '{print substr($Flag,0,$NewLen)}'`
echo "New string is : $NewFlag"
exit
When I execute this script the following error message appears :
awk: 0602-562 Field $() is not correct.
The input line number is 1.
The source line number is 1.
Could you please guide me to resolve this error.
Thanks in advance.