Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> writes:
> there is way to crop data to wanted, by cropping the exclulsions away
> but what about a way to extract data, eg @( .. ) match
> not about using [[ =~ but only var internal stuff
> .. or do i miss there something
If you want to do a pattern-match against a string, then extract a part
of it, a common way is to use sed. For instance, to extract a word and
remove spaces before and after it:
$ STRING=' abc def '
$ WORD="$( <<<$STRING sed -e 's/^ *\([^ ]*\) *$/\1/' )"
$ echo "$WORD"
It is common to use common Unix utilities to modify data items within
shell scripts.
Dale