How i can sed
save pattern matches to variables and do something with it? eg
$ echo "string_4.3.2" | sed 's/^string_\([0-9]\)\.\([0-9]\)\.\([0-9]\)$/\1 \2 \3/'
output "4 3 2" but I want to pass variables to function eg
do_something() {
echo $1
echo $2
echo $3
# .....
# .....
}
string="string_4.3.2"
if [[ $string =~ `sed ??????` ]]; then
do_something "$1" "$2" "$3"
fi
Matched numbers need pasing to method "do_something"