Skip to main content
6 events
when toggle format what by license comment
Jul 14, 2019 at 12:51 comment added Victor Yarema @jakub.g , I have GNU sed (v4.4 now). Not sure about the others. What I know is that it uses "basic" regular expression syntax by default this is why your example didn't work. To achieve what you want you can either put a backslash in front of each vertical line or you can ask sed to use "extended" regular expressions. More information here: gnu.org/software/sed/manual/html_node/… . Please note that this is applicable to grep as well. Here's my own working example: echo $'0a\n1b\n2c' | sed '/0a\|1b/d'.
Apr 13, 2017 at 12:36 history edited CommunityBot
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Jul 23, 2014 at 11:48 history edited Stéphane Chazelas CC BY-SA 3.0
added 47 characters in body
Nov 21, 2012 at 9:58 comment added jakub.g The other plus in the AWK solution is that I can replace /bar/ with /bar|baz|whatever/. In sed that syntax doesn't seem to work.
Nov 19, 2012 at 20:25 history edited Stéphane Chazelas CC BY-SA 3.0
added 115 characters in body
Nov 19, 2012 at 20:10 history answered Stéphane Chazelas CC BY-SA 3.0