ed
Steve Summit
stevesu at bronze.UUCP
Sat Sep 24 06:16:33 AEST 1983
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
More information about the Comp.unix.wizards
mailing list