REGULAR EXPRESSIONS

  • Examples:
    $ echo "Hello world" | sed 's/w.*/X/g'
      Hello X
    $ echo "Hello world" | sed 's/w*/X/g'
      XHXeXlXlXoX XXoXrXlXdX
    $ echo "Hello world" | sed 's/^.* /X/g'
      Xworld
    $ echo "Hello world" | sed 's/.$/X/g'
      Hello worlX
    $ echo "Hello world" | sed 's/[wo]/X/g'
      HellX XXrld
    $ echo "Hello world" | sed 's/[^wo]/X/g'
      XXXXoXwoXXX