Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utcsrgv.UUCP Path: utzoo!utcsrgv!dave From: dave@utcsrgv.UUCP (Dave Sherman) Newsgroups: net.unix Subject: Re: editor query Message-ID: <2602@utcsrgv.UUCP> Date: Mon, 31-Oct-83 12:11:02 EST Article-I.D.: utcsrgv.2602 Posted: Mon Oct 31 12:11:02 1983 Date-Received: Mon, 31-Oct-83 13:44:03 EST References: <519@hcr.UUCP> Organization: The Law Society of Upper Canada, Toronto Lines: 22 hcr!doug asks how to get an editor to delete every line containing A except for those which also contain B. ed will do it: g/B/s/A/ZZZZZ/g g/A/d g/ZZZZZ/s//A/g Presto. It's a little ugly, but it works, and quickly too. Pick your favourite string for ZZZZZ. It should of course be something that doesn't occur elsewhere in the file, but unless you're dealing with random ASCII text, that's not hard to find. If you have qed and need this often enough, it can easily be automated into a string register or buffer. Dave Sherman Toronto -- {allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave