SED: Matching on 2 patterns on the same line
- by Brian Knott
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.