Re: exclude atom from being matched (multiple letters)
Thierry Blanc <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
On 09/05/13 10:52, Davide Brini wrote: > 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; } > yes, this is what I just found out, but it is far less elegant ...