The trick to successful operations with whole lines in data tables is the correct use of line addresses. You need to be sure not only that the operation is done where you want it, but also that it isn’t done where you don’t want it.
Source: LXer – How to delete, insert and replace whole lines