Skip to main content

Just delete everything until the last slash:

$ echo "blablabal/important" | sed 's:.*/::'
important
$ echo "blablabal/important" | sed 's:.*/::'
important

It also works with multiple slashes:

$ echo "blablabal/not/ver/interesting/important" | sed 's:.*/::'
important
$ echo "blablabal/not/ver/interesting/important" | sed 's:.*/::'
important

Just delete everything until the last slash:

$ echo "blablabal/important" | sed 's:.*/::'
important

It also works with multiple slashes:

$ echo "blablabal/not/ver/interesting/important" | sed 's:.*/::'
important

Just delete everything until the last slash:

$ echo "blablabal/important" | sed 's:.*/::'
important

It also works with multiple slashes:

$ echo "blablabal/not/ver/interesting/important" | sed 's:.*/::'
important
Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718

Just delete everything until the last slash:

$ echo "blablabal/important" | sed 's:.*/::'
important

It also works with multiple slashes:

$ echo "blablabal/not/ver/interesting/important" | sed 's:.*/::'
important