jameschaucer
Programmer
In ksh93, I want to match on a string and be able to print out the subpatterns like I do in perl.
Given the following:
line="abc (hij) = lmn"
if [[ $line = @(*[a-z]\(*[a-z]\)=*[a-z]) ]]; then
v1=${.sh.match[1]}
v2=${.sh.match[2]}
v3=${.sh.match[3]}
print "v1=$v1 \nv2=$v2\nv3=$v3"
fi
What would do to emit the different pieces of this string? ie, to get v1=abc v2=hij v3=lmn ?
Nothing I try comes close to working.
I have a bunch of perl I've been told to convert into ksh so this answer would help a lot.
thx
Given the following:
line="abc (hij) = lmn"
if [[ $line = @(*[a-z]\(*[a-z]\)=*[a-z]) ]]; then
v1=${.sh.match[1]}
v2=${.sh.match[2]}
v3=${.sh.match[3]}
print "v1=$v1 \nv2=$v2\nv3=$v3"
fi
What would do to emit the different pieces of this string? ie, to get v1=abc v2=hij v3=lmn ?
Nothing I try comes close to working.
I have a bunch of perl I've been told to convert into ksh so this answer would help a lot.
thx