Tom Lynch
2022-01-19 13:51:02 UTC
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"
What I would like to get is the "v1.1.0" of the "tag=" portion
I'm using the following to parse, since this is a BitBake recipe, I need to account for line extensions, so I run it through a perl script first, but the entire line:
perl -pe 's/\\\n|\s{2,}/ /g' foo.bb | grep SRC_URI | grep -v '#' | sed -r 's#.*tag=(.?+)(;|\s+|\").*#\1#'
What this gets is:
v1.1.0;lfs=0;subpath=pctrlmc/c2cmtd
it's missing the semicolon delimter, if I change the sed to:
sed -r 's#.*tag=(.?+);.*#\1#'
It's still missing the first semicolon
v1.1.0;lfs=0
I need to account for other types of delimiter, thus the (;|\s+|\"), but no matter what I've tried, I can't seem to capture just the tag there. What I'm I doing wrong?
Thanks in Advance for any help!
Tom
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"
What I would like to get is the "v1.1.0" of the "tag=" portion
I'm using the following to parse, since this is a BitBake recipe, I need to account for line extensions, so I run it through a perl script first, but the entire line:
perl -pe 's/\\\n|\s{2,}/ /g' foo.bb | grep SRC_URI | grep -v '#' | sed -r 's#.*tag=(.?+)(;|\s+|\").*#\1#'
What this gets is:
v1.1.0;lfs=0;subpath=pctrlmc/c2cmtd
it's missing the semicolon delimter, if I change the sed to:
sed -r 's#.*tag=(.?+);.*#\1#'
It's still missing the first semicolon
v1.1.0;lfs=0
I need to account for other types of delimiter, thus the (;|\s+|\"), but no matter what I've tried, I can't seem to capture just the tag there. What I'm I doing wrong?
Thanks in Advance for any help!
Tom