Based on your shown samples, could you please try following.
1st solution: Create a variable with substr
of awk
and then play with it to get exactly needed shown value, this approach will be useful in case we need to use this variable for further in the program too. Where tst=/oracle/orcl/dbms1911c
is the variable's value as per shown samples.
printf '%s' ${tst} |
awk -F'/' '{val=substr($4,5,6);print substr(val,1,2) substr(val,5)}'
2nd solution: Without using a variable and using substr
itself, though I feel 1st approach is BEST that variable could be used for other tasks also, for fun and as an another option adding this one.
printf '%s' ${tst} |
awk -F'/' '{print substr(substr($4,5,6),1,2) substr(substr($4,5,6),5)}'
3rd solution: or try this substr also here like:
printf '%s' ${tst} |
awk -F'/' '{print substr($4,5,2) substr($4,9)}'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…