regex - Remove substring till first Token using regexp -
i have path:
garbagecontainingslashesanddots/token/xyz/token/abc
how coukt remove garbagecontainingslashesanddots? know, before token, unfortunately, there 2 substrings token in string. using sed s/.*token//
makes string /abc, need /token/xyz/token/abc thank you!!!
divide , conquer:
$ echo 'garbage.containing/slashes/and.dots/token/xyz/token/abc' | sed -n 's|/token/|\n&|;s/.*\n//;p' /token/xyz/token/abc
Comments
Post a Comment