unix - Substring command not working in solaris kshell -
i trying use following command extract substring string :
propertypath=$(echo $path|awk '{print substr($0,3,$index)}')
however command not pick value of $index
variable , therefore not return valid substring.
this work:
propertypath=$(echo $path|awk '{print substr($0,3,'$index')}')
or
propertypath=$(echo $path|awk -v index=$index '{print substr($0,3,index)}')
Comments
Post a Comment