[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Query on best programming practice



For years, I've had problems with changing lines with CI /// when similar
lines are stacked above another.
To give a simplified, artificial, example: suppose I want to change all
lines consisting only of the one word "Harry" to "Barry." So I use:

CI/{CrLf}Harry{CrLf}/{CrLf}Barry{CrLf}/
--{CrLf} being the red arrow you use on the command line for these things; I've omitted here the TF, BX, and Q2.

That command will not find the second Harry in a stack:

Harry
Harry

so the result of the CI command will be:

Barry
Harry
More generally, the same skipped elements result from running CI /xax/xbx/ on xaxaxaxa.

(Running SE /xax/ on xaxaxax shows why this happens.)
What is the best way to make sure no stacked elements are skipped? I've been simply running the command twice, repositioning the cursor at the Top of the File (CI/t not being 100% reliable):

CI/{CrLf}Harry{CrLf}/{CrLf}Barry{CrLf}/
CI/{CrLf}Harry{CrLf}/{CrLf}Barry{CrLf}/
But in the program in question, I do dozens of such CI's, so I want a more economical solution than doubling dozens of lines. It just occurred to me that I can solve the problem by double-spacing the file I'm running the program against. I need only do this once at the top of the program:

CI /{CrLf}/{CrLf}{CrLf}/

then I can reverse this at the end of the program.
But is there a better way? Maybe putting in a [NO ] between the lines? Then taking them out at the end?

Comments appreciated.

--Harry