Pages

Saturday, March 19, 2011

Some string manipulations is shell script

var="hai hello world tom"

pattern output
echo ${var%%hello*} //hai
echo ${var%%tom} //hai hello world
echo ${var##*hello} //world tom
echo ${var##hello*} //hai hello world tom
echo ${#var} // 19

No comments:

Post a Comment