Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.questions Subject: Re: matching and replacing across line breaks Keywords: sed awk Message-ID: <11817@smoke.BRL.MIL> Date: 14 Dec 89 22:56:25 GMT References: <12329@burdvax.PRC.Unisys.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 27 In article <12329@burdvax.PRC.Unisys.COM> lang@PRC.Unisys.COM (Francois-Michel Lang) writes: >Can anyone provide a solution to this problem, >preferably using sed or awk or some such utility: >I want to operate on a file in such a way that every occurrence of >"foo" at the end of one line followed by "bar" at the beginning of the >next line is replaced by "quux". I have a way to do this using sed >that works *most* of the time, but there are certain cases in which >it fails. Since I personally feel every UNIX site should have "sam" on hand, here's my solution: sam -d file_to_be_edited <