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.

2
  • yes this worked perfectly. thank you! Commented Jan 16, 2022 at 16:38
  • 1
    @itnera are you sure? Try changing one of the first 3 worlds to otherworldly - is what it does then correct? You'd also get some interesting results given various input if your target string contained regexp metachars since it's doing a partial regexp comparison when you should really be doing a full word string comparison. Are the constructs being used all POSIX-compliant or are some GNU extensions? Does that matter? I've been using sed for 40 years and couldn't answer that because I'd never use it for a task like this. Commented Jan 16, 2022 at 20:35