I just want to match some text in a Bash script. I\'ve tried using sed but I can\'t seem to make it just output the match instead of replacing it with something.
I don't know why nobody ever uses expr: it's portable and easy.
expr
newName() { #Get input from function newNameTXT="$1" if num=`expr "$newNameTXT" : '[^0-9]*\([0-9]\+\)'`; then echo "contains $num" fi }