Conversation

Notices

  1. I've finally found out you can match word1 OR word2 w/ sed with

    echo MarsWord1MissionWord2 | sed -r "s/(Word1)|(Word2)//g"

    MarsMission

    Sunday, 04-Jun-17 21:53:12 UTC from quitter.se
    1. → actually (…|…) is sufficient (so it's just like egrep):

      echo MarsWord1MissionWord2 | sed -r "s/(Word1|Word2)//g"

      MarsMission

      Sunday, 04-Jun-17 23:40:10 UTC from quitter.se
      1. →and you can also do it without -r, i.e. without # #, you just need to escape "(", ")" and "|":
        sed "s/\(Word1\|Word2\)//g"

        Sunday, 04-Jun-17 23:43:59 UTC from quitter.se
        1. → it just took me from 1997 to 2017 to find that out. #

          Sunday, 04-Jun-17 23:47:14 UTC from quitter.se