String variable question help plz

Dear all,
I have problem with string variable, I want to write script which do the following

read x
x="part1=part2"

then I want to sub the x variable for
x1="part1"
and
x2="part2"

Is that possible ??

x1=$( echo $x | cut -f1 -d"=" )
x2=$( echo $x | cut -f2 -d"=" )

--ahamed

thank you its working, but if I want to return the column number in grep
ex:
a,b,c,d,e,f,g # in file1
grep d file1
I want output 4

awk -F, '{ for(i=1;i<=NF;i++){if(srch==$i){print i;exit}} }' srch="d" infile

--ahamed

Thank you very much, I am new in script :slight_smile: