Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!floyd!vax135!cornell!uw-beaver!tektronix!tekmdp!bronze!stevesu From: stevesu@bronze.UUCP (Steve Summit) Newsgroups: net.unix-wizards Subject: ed Message-ID: <772@bronze.UUCP> Date: Fri, 23-Sep-83 16:16:33 EDT Article-I.D.: bronze.772 Posted: Fri Sep 23 16:16:33 1983 Date-Received: Mon, 26-Sep-83 09:19:20 EDT Lines: 27 Has anyone else been bothered by the following limitation of ed? There is no easy way to specify the second (or third or fourth...) instance of a pattern on a line in an s command. (There is probably some horrendous way to do it with \( but it certainly wouldn't be easy.) For instance, I have the line printf("c[i] = %d = 0%o = '%c'\n", c[i], c[i], c[i]); and I want to change the last c[i] to c[i++]. In this case I could distinguish it with the trailing ')', but it's not always that easy. (Please don't ask me why I'm using ed. I think most people would agree that there are some global type edits that are still best done with a line based editor. Of course I use a screen editor most of the time.) I've actually considered adding this feature myself, but I haven't figured out a syntax and I'm not anxious to dive into the regular-expression code. Has anyone figured out a decent way to do this with vanilla ed? Has anyone implemented it? Do the (apparently) ed-compatible ex and vi have a pattern-match extension to make it easier? Steve Summit tektronix!tekmdp!bronze!stevesu