command does a lot of different things with expressions.
One expression it handles has three arguments: first, a string; second,
a colon (
:); third, a
The string and regular expression usually need quotes.
expr can count the number of characters that match the
The regular expression is automatically anchored to the
start of the string you're matching, as if you'd typed a
at the start of it in grep, sed, and so on.
expr is usually run with
to save its output:
part="resistor 321-1234-00" name="Ellen Smith"... $
expr "$part" : '[a-z ]*[0-9]'...character position of first number 10 $
len=`expr "$name" : '[a-zA-Z]*'`$
echo first name has $len charactersfirst name has 5 characters