Saturday, August 29, 2009

Sed: Delete next n lines after match


ALTER TABLE some_table ......
CREATE VIEW user_log_view AS
SELECT some_column .....
SELECT * FROM some_table ...


cat dump.sql | sed "/CREATE VIEW user_log_view/,+2d" Would delete CREATE VIEW statement definition.

No comments: