SED: Matching on 2 patterns on the same line

Posted by Brian Knott on Stack Overflow See other posts from Stack Overflow or by Brian Knott
Published on 2010-04-30T01:07:00Z Indexed on 2010/04/30 1:17 UTC
Read the original article Hit count: 318

Filed under:
|

Hi I want to delete a line using sed if it matches 2 regular expressions in the same line. EG the line starts with /* and end with */ (comment). The following script will do most of that. sed -e '/^\/*/ d' -e '/*\/$/ d' filename This script will remove all lines that start with * and end with */. I want it to remove the line only if is meets both criteria not one.

© Stack Overflow or respective owner

Related posts about sed

Related posts about linux