unix - sed extract something from string -
I have a string "r1 / pkg / amd64 / misc / hash / hash-r1.r5218.tbz" But, I only want "hash-r1.r5218.tbz"
Therefore, I try
unix $ a = "r1 / pkg / amd64 / misc / hash / Hash-r1.r5218.tbz "Unix $ echo $ a | Sed 's /.* \ / \ ([^ \ \] * \) \. Tbz / \ 1 / '// [1] hash-r1.r5218 // I know that this should work unix $ ek $$ Sed 's /.* \ / \ ([^ \ /] + \) \ tbz / \ 1 /' // [2] r1 / pkg / amd64 / misc / hash / hash-r1.r5218.tbz // though I do not know why this does not work As far as I remember, in regexp, the previous regexp means 1 or more times to use. * In Regexp, the previous regexp means 0 or more times to use.
Can anyone be understood? [2] Why failed, thank you very much
All code sed support + is required to specify something that supports -r in the regedx. But instead of sed using basename or echo $ {a ## * /} Why should
Comments
Post a Comment