Re: exclude atom from being matched (multiple letters)
Davide Brini <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 09 May 2013 10:44:57 +0200, Thierry Blanc <[email protected]> wrote: > Can sed negate matching an atom, i.e. multiple letters? > > Example: match any line starting with foo, but NOT ending with a dot > followd by zero or more spaces > > (end of line marked with $) > > foo rhabarber etc .$ > foo rhabarber etc . $ > foo rhabarber etc$ > foo rhabarber etc $ > > > only match third and forth line. > > atom is: > (\. *) > > negate atom??? > sed '/foo.*^(\. *)$/ # does not work, of course, matches beginning of > line Why not do sed '/^foo/{ /\. *$/b; process matching lines here; } -- D.