Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!mks!tj From: tj@mks.UUCP Newsgroups: comp.unix.questions Subject: Re: sed - match newlines on input Message-ID: <226@mks.UUCP> Date: Wed, 11-Mar-87 18:37:48 EST Article-I.D.: mks.226 Posted: Wed Mar 11 18:37:48 1987 Date-Received: Thu, 12-Mar-87 03:37:03 EST References: <570@hao.UCAR.EDU> Organization: Mortice Kern Systems, Waterloo, Ont. Lines: 32 Keywords: imbedded newline, broke! Summary: match multiple input lines in sed In article <570@hao.UCAR.EDU>, bill@hao.UCAR.EDU (Bill Roberts) writes: > I'm trying to match a pattern over multiple lines. For instance, on the input: > one > two > three > with the sed script: > s/one\ntwo\nthree/one, two, three/g > one would expect to get the following output > one, two, three > OK, so I don't understand the manual (what else is new). How can I get what I > need? Also, what about the "Multiple Input-line Functions". Might that be the > way to go? An example would really help. Thanks in advance. sed -e '/one$/{ N N s/one\ntwo\nthree/one, two, three/ }' This solution was found without effort on the first attempt. Perhaps MKS Toolkit documentation is better than some... ;-) ll // // ,~/~~\' T. J. Thompson {decvax,ihnp4,seismo}!watmath!mks!tj /ll/// //l' `\\\ Mortice Kern Systems Inc. / l //_// ll\___/ 43 Bridgeport Rd. E., Waterloo, ON, Can. N2J 2J4 O_/ (519)884-2251 -- ll // // ,~/~~\' T. J. Thompson {decvax,ihnp4,seismo}!watmath!mks!tj /ll/// //l' `\\\ Mortice Kern Systems Inc. / l //_// ll\___/ 43 Bridgeport Rd. E., Waterloo, ON, Can. N2J 2J4 O_/ (519)884-2251