Re: Trouble with sed and semicolon delimiter...

"Michael F. Stemper" <[email protected]>
Newsgroups alt.comp.lang.shell.unix.bourne-bash
Organization A noiseless patient Spider
Message-ID <[email protected]>
On 19/01/2022 07.51, Tom Lynch wrote:
> Greetings,
> 
> 	I'm having trouble with the sed portion of a bash script. I'm trying to get
> 	all the tags from BitBake recipes. I have the following line:
> 	
> 	SRC_URI = "git://bb/foo.git;protocol=ssh;tag=v1.1.0;lfs=0;subpath=pctrlmc/c2cmtd"

Are you sure that's what you have? When I execute that line, I get

$ SRC_URI = 
"git://bb/foo.git;protocol=ssh;tag=v1.1.0;lfs=0;subpath=pctrlmc/c2cmtd"
SRC_URI: command not found
$

(Give or take the gratuitous line-wrap inserted by Thunderbird)

> 	What I would like to get is the "v1.1.0" of the "tag=" portion

I know nothing about perl, so I can't help with that.

Can you just use sed?

$ 
SRC_URI="git://bb/foo.git;protocol=ssh;tag=v1.1.0;lfs=0;subpath=pctrlmc/c2cmtd"
$ echo $SRC_URI | sed 's/.*;tag=//' | sed 's/;.*//'
v1.1.0
$


-- 
Michael F. Stemper
Nostalgia just ain't what it used to be.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.