why this does not match..?
sed -e '/--Updated?[[:space:]]+Date/d' inputfile
this..:
--Updated Date: 2013-11-06 15:32:13
d?
is because sometimes I have Update Date
, and sometimes Updated Date
.
for removal? I have tried with \s
too, not working.
Best Answer
you need to use the
-r
parameter. try useupdating answer
When you use
sed '/something/d'
, every line that match with this will be deleted.-r
- the parameter -r is use extended regular expressions .Inside the expression have 2 regular expressions.
[[:space:]]
- Match with all whitespace characters, including line breaks+
- one or more times.SO, the command sed will delete every line that match with --updated and than one or more whitespace character and than Date but because of the ? the character d is optional. like: