Delete the first line that matches a pattern
Posted
by
gioele
on Stack Overflow
See other posts from Stack Overflow
or by gioele
Published on 2014-06-06T09:12:40Z
Indexed on
2014/06/06
9:25 UTC
Read the original article
Hit count: 272
sed
How can I use sed to delete only the first line that contains a certain pattern?
For example, I want to remove the first line matching FAA from this document:
1. foo bar quuz
2. foo FAA bar (this should go)
3. quuz quuz FAA (this should remain)
4. quuz FAA bar (this should also remain)
The result should be
1. foo bar quuz
3. quuz quuz FAA (this should remain)
4. quuz FAA bar (this should also remain)
A solution for POSIX sed would be greatly appreciated, GNU sed is OK.
© Stack Overflow or respective owner