Add (Moving Lines within a File)

Qedit 5.7 for HP-UX

Home Previous Next


Add (Moving Lines within a File)

Move some lines from one place in the file to another, deleting them from the original position.

ADD linenum < rangelist

(Q=no display)

(Defaults: none)

The linenum tells Qedit where to move the lines. The number of decimal places in linenum determines the line number increment. For example, "/add 5.10<100/200" creates lines 5.10, 5.11, 5.12, etc.

The rangelist tells Qedit which lines to move. Add deletes the original lines after moving them. You still only have one copy of each line.

Examples

/list 4/7         {how lines look before the move}
    4     aaaaaaaa
    5     bbbbbbbb
    6     dddddddd
    7     cccccccc
/add 5 < 7        {move line 7 after line 5}
    5.1   cccccccc
1 line MOVED
/list 4/7         {how lines look after the move}
    4     aaaaaaaa
    5     bbbbbbbb
    5.1   cccccccc
    6     dddddddd

Notes

Control-Y during a move stops the move, but it also changes the move into a copy. The lines being moved in the current range are not deleted.

Add-Move ignores Set LEFT/RIGHT margins; it moves entire lines. However, it only prints the portion of the line within the current margins.

When you copy or move lines using Add= or Add<, Qedit first puts the lines into a "Hold" file called Hold0. It then counts the lines. If you do not have sufficient line numbers to insert the new lines, Qedit stops and prints "Error: Already". Use Renum to renumber the range of line numbers and then copy the lines from the Hold0 file. See also the Hold command.

/list hold0
/add 55=hold0     {add from Hold file}


Home Previous Next