need help on sed

I need sed expert help here

A=`echo $INTERFACE| sed -e 's/[0-9]//g'`
B=`echo $INTERFACE | sed -e 's/[a-z]//g'`

If $INTERFACE is bge0, ce1, qfe2, the script above works just file. It will give the bge, ce or qfe to A, and the number to B.

But it doesn't work for e1000g0. Could anyone help me to split e1000g0 to e1000g and "0" by sed? It should also work for bge0, ce1 or qfe2 as well.

By the way, all these are Solaris NIC names.

Thanks in advance!

try this...

echo e1000g0 | sed 's/[0-9]$//g'

That works for A.
How about B variable? How can I cut "e1000g" out and only leave the last number or numbers to B? And I do need it work for bge0 as well.

Thanks!

Haha, I figured myself. A=`echo e1000g0 | sed 's/\(.*[a-zA-Z]\)\([0-9]\)/\1/'` or A=`echo e1000g0 | sed 's/[0-9][0-9]$//g'` B=`echo e1000g0 | sed 's/\(.*[a-zA-Z]\)\([0-9]*\)/\2/'`