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 ...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.