3 ms·
It's interesting to read up on the relationship between ed, sed, ex, and vi. In fact, all 4 of those editors have similar ways of addressing line ranges (1 for
by u801e 10y ago
It's interesting to read up on the relationship between ed, sed, ex, and vi. In fact, all 4 of those editors have similar ways of addressing line ranges (1 for the first line, $ for the last line, etc).
One interesting feature many people may not know about is that it's possible to address lines using a regular expression.
For instance, if you had the following text in a vim buffer:
one
two
three
four
five
and you wanted to delete the lines between "two" and "four" inclusive, you could run the following command in vim:
:/two/,/four/d
You could also do the same thing in sed
sed '/two/,/four/d' filename