substitute words on a line only before first delimeter using sed or awk

with sed

sed -r 's_([^/]+/)__'

similarly with awk

awk '{sub(/[^/]+\//,"")}1'

however, cut is the most proper tool for this task

cut -d/ -f2- 

Leave a Comment