I need to extract the string after the : in an example below:
package:project.abc.def
Where i would get project.abc.def as a result.
I am attempting this in bash and i believe i have a regular expression that will work :([^:]*)$.
In my bash script i have package:project.abc.def as a variable called apk. Now how do i assign the same variable the substring found with the regular expression?
Where the result from package:project.abc.def would be in the apk variable. And package:project.abc.def is initially in the apk variable?
Thanks!
There is no need for a regex here, just a simple prefix substitution:
The ## syntax is one of bash’s parameters expansions. Instead of #, % can be used to trim the end. See this section of the bash man page for the details.
Some alternatives: