<tr><td>Apples<td>10 cents <tr><td>Oranges<td>12 cents <tr><td>Tangerines<td>30 cents <tr><td>Watermelon<td>50 cents
<tr><td>Apples<td>10 cents<td>Tangerines<td>30 cents <tr><td>Oranges<td>12 cents<td>Watermelon<td>50 cents
Qedit for Windows lets you do this:
Control-Drag To select one column in your file, hold down the CONTROL (CTRL) key while you drag the mouse. This highlights a rectangular selection on your screen.
To copy one column to the clipboard, select a rectangle and use either Copy (CTRL+C) or Cut (CTRL+X) to put it in the clipboard. In this case I select everything after the <tr> in the lines that I want to move up. For example, Figure 1 shows a rectangular selection within some table Tags.
To append the clipboard column after the existing column, I create another rectangular selection in the empty space to the right of the column and Paste (CTRL+V) into it. I have now doubled up the columns.
A few tips for rectangular editing
Use the relative line numbers shown in the lower right corner of the document window (far right on the document status bar) to calculate how many lines there are in total and thus how many lines per column. Insert a blank line at the division point so that you can spot it while pasting. Since it wont come out even most of the time, copy a few extra lines and then edit the last couple of lines of the combined table.
Figure out the longest line in the first column and start your rectangular selection at that column on the top line of the table. But you also have to make your selection wide enough, so estimate the longest line in the clipboard and add that to the starting column number of the selection to create the right edge. The column numbers appear in the lower right corner of your document window, just like the line numbers. I start the selection at the top right corner, drag left to the top left corner, then drag down to the bottom left corner. In this way I can see the text to the left as I am dragging and I know when to stop! Another way to know when to stop is to watch the size of the selection in the lower right corner.
Dont make your paste rectangle too short (less lines than were copied to the clipboard), or you may lose some lose lines at the end of your clipboard. If the paste rectangle is too long (more lines than were copied to the clipboard) then lines from the top of the copy rectangle are repeated in the paste area. If the copy rectangle is wider than the paste rectangle, lines from the clipboard are truncated. If the paste rectangle is wider then lines are padded with blanks.
The text in the paste rectangle, if any, is replaced during the paste operation. If you wish to blank out the rectangle first, you use the Delete function of the Column command on the Edit menu. Make sure you enable the Fill with spaces option on the Delete Columns dialog box. If you wish to insert the copy rectangle, use the Insert function of the Column command on the Edit menu to insert an appropriate number of blanks. Then select the empty area as the paste rectangle.
By the way, if you have Tab characters in the lines, Qedit takes care of ensuring that the text remains aligned visually, by converting Tabs into Spaces and vice-versa, as needed.
How would you do this with commands in host-based Qedit?
The basic technique with commands is simple: Set Left at the left edge of the source rectangle and Hold the lines, then Set Left at the left of the Paste rectangle, and finally do a Replace $Hold to copy replacement text for those columns only from the clipboard. This effectively does a merge.
List <tr> | !count table lines=100 |
Find First; Find <tr> | !find first table line |
List *+50 | !find start of 2nd col |
Zz */ *+49 | !mark 2nd column |
Set left 5 | !set margin after <tr> |
Holdq zz | !hold col 5-end |
Set Left 1 | !reset margin |
Delq zz | !delete the 2nd col |
Find First; Find <tr> | !go back to 1st col |
Set Left 50 | !set 2nd col margin |
Replace $Hold,*/*+49 | !insert the column |
Set Left 1 | !reset the margin |
The column move is
do-able with edit commands, but it is certainly more work than a
couple of mouse drags and clicks!
Bob Green
Host-based Qedit offers the ability to work on columns. One common example is to put the same text in specific columns of a range of lines. For example, to put New text in columns 1 through 10 on all lines, you would do:
/Change 1/10 "New text" AllEven though the Qedit for Windows Replace command can work on columns, you can't use it as it only replaces existing string occurrences found within these columns.
Here's how you change columns with Qedit for Windows:
This is Line1. This is Line2. This is Line3. This is Line1. This is Line2. This is Line3. This is Line1. This is Line2.To define a rectangular selection, you have to hold the
Shift
key down while
dragging the mouse with the left button down. This works fine if you have a small number of
lines to select. It's not as practical if you have a large number of lines. Here are 3 ways
to make that easier.
CTRL
and SHIFT
and click
CTRL
, SHIFT
and END
François Desrochers
New: Syntax Coloring in Qedit for Windows
Use "Favorites" to Organize Projects
Advanced Selection Tips in Qedit for Windows
More Tips On Qedit for Windows