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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -