close
This example tells us how to extract sub string from a long string.
while read stringLine
do
length=`expr length "$stringLine"`
substr=`expr substr "$stringLine" 1 $(($length-1))`
echo $substr
done < input_file
Attention:
1. if we want to express a equation in the `expr` , we need to use $(()) to cover this equation.
全站熱搜