6 Sep
2024
6 Sep
'24
4:35 p.m.
Also, if you want to make this portable so it works on other shells than just bash, you can do something like this to get the port number:
echo $a | cut -f4- -d"'" | rev | cut -c 5- | rev
There are probably other ways to do it using sed, etc.
Here is a sed equivalent, which might be a more conventional approach: $ echo $a <cmd='send_data' msg='12345' '> $ echo $a | sed "s/^.*msg=[']\([^']*\)['].*$/\1/" 12345 -Alex