1 2 3 4 5 6 7 8 9
shaun@laptop:~/scripts$ cat test.sh f="power status: off" regex="power status: (\w+)" if [[ $f =~ $regex ]] then match="${BASH_REMATCH[1]}" echo "Found it was $match" fi