Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 2
    Neither \w nor + are POSIX sed. Commented Apr 22, 2022 at 12:05
  • Hi the command I provided works fine on ubuntu. Can you please tell me what to use instead to get it work cross platform ? Commented Apr 22, 2022 at 12:42
  • The portable form of \w is [[:alnum:]]; the portable form of + is {1,} (one or more occurences). So your litetal command is sed -E 's/deploy-[[:alnum:]]{1,}-([[:alnum:]]{1,})/\1/'. But in the end, it seems you are looking for sed '/deploy-/s/.*-//' Commented Apr 22, 2022 at 14:28