I have this string
blah --arg1 --arg2 --etc doh
sometimes doh ending in slash, sometimes not.
i need to extract doh and assign to a var.
then replace it with /some/path/doh
I wont put here my tries, they are way too ugly.
— updated —
mm, not sure i understand the answers, sorry.
the final string should be like:
blah --arg1 --arg2 --etc /some/path/doh
and doh assigned to a var, say foo
kinda ugly but working
first of all getting rid of eventual trailing slashes:
next extracting
dohand lastly removing it from string and adding back prefixed by
/some/path