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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -