Global Changes

Qedit 5.7 for HP-UX

Home Previous Next


Global Changes

There is another way to modify lines in your workfile. The Change command allows you to make changes throughout the entire file, without the bother of working on each line one by one. For example, with one Change command to your memo, you can replace all the colons with dashes.

/change ":"-" all
  1    MEMO TO- Drama Staff, News Simulation Dept.
  2.1  DATE-  November 19, 2000
  3    FROM-    Marie Reimer, Publicity Dept.
3 lines changed

Using the Change All command is a one-way street. If we now decide we don't like the dashes and want to get the colons back, observe what happens to Line 5.

/change"-":" all
  1    MEMO TO: Drama Staff, News Simulation Dept.
  2.1  DATE:  November 19, 2000
  3    FROM:    Marie Reimer, Publicity Dept.
  5    Please check your in:baskets daily and
4 lines changed

This second Change command has gotten us into hot water. Luckily, Qedit has an Undo command that takes your file step-by-step backwards to put it back to the way it was. See the Undo command in the "Qedit Commands" chapter.

CJ Command

If you're not sure what the consequences of a global change will be, use the CJ command. CJ stands for Change-Jump. Qedit shows you each line it means to change, and waits for you to approve, to change your mind, or to modify that line. Then Qedit jumps to the next occurrence of your string, and repeats its question until you have dealt with all occurrences of the string in the file. To accept the default answer of NO (i.e., don't replace the string), shown in square brackets, just press Return.

/cj":"-" all
  1    MEMO TO: Drama Staff, News Simulation Dept.
Change okay (Y,N or Modify) [No]:  {press Return}
  2.1  DATE:  November 19, 2000
Change okay (Y,N or Modify) [No]:  {press Return}
  3    FROM:    Marie Reimer, Publicity Dept.
Change okay (Y,N or Modify) [No]:  {press Return}
  5    Please check your in:baskets daily and
Change okay (Y,N or Modify) [No]:Yes
1 line changed

You can use the handy ^Y to stop in the midst of change-jumping just as you used it to stop listing.

Rangelist

You can also specify individual lines or a rangelist to Change. For example,

/change "Dept."Department" 1/3
  1    MEMO TO: Drama Staff, News Simulation Department
  3    FROM:    Marie Reimer, Publicity Department
2 lines changed
/change "Drama Staff, "" 1  {changes string to nothing}
                            {i.e., deletes it}
  1    MEMO TO: News Simulation Department
1 line changed


Home Previous Next