bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: missing way to extract data out of data


From: Alex fxmbsw7 Ratchev
Subject: Re: missing way to extract data out of data
Date: Fri, 19 Mar 2021 07:51:42 +0100

yea well it does wonders, however was looking for a way without spawning
externals like gawk.. maybe in future there will be =)

On Fri, Mar 19, 2021 at 2:02 AM Dale R. Worley <worley@alum.mit.edu> wrote:

> 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
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]