One of UltraEdit's most powerful features is its easy-to-use Column Mode. Column Mode allows you to select columns of data (as opposed to rows) by changing the way you can select text in the editor. When in column mode (sometimes referred to as "block mode"), UltraEdit will highlight text based on the column position of the first character you select to the column of the last character you select. Text selected in column mode does not automatically include all text between the start and end position, but does include all text in the columns between the first and last character you select. With Column Mode, you can edit columns of data in just seconds!
When column mode is enabled, additional features in the column menu are enabled as well. In the next few paragraphs, we'll take a look at some of those features.
To enable Column Mode, press ALT + C, or select it from the "Column" menu.
You can configure a font of your choice from the "View" menu as a visual cue that you are editing in column mode. For this tutorial we've chosen a bold version of our standard font.
Once the cursor is positioned correctly, you may type in your string. The entire block of code has been commented out of the document.
Column Mode may also be used to manually prepend or append sets of data spanning a column. In the following sample data, we would like to add a character to the beginning of each value after the "=" character. The added character will be the same for all values. As before, click and drag to create a "multiline cursor" to insert the new character.
You can prepend an entire column of data, with the same character, by simply typing.
The "Insert/Fill Columns" command under the "Column" menu allows you to enter a text string into a specific column in your data. If a column is selected, the string will be inserted into every selected line. However if nothing is selected, the string will be inserted into all lines in the document. If there is no text data at the specified column on a row within the document, spaces will be added to pad the row, thereby allowing the text to be inserted in the correct position.
In the below sample data, the "Product" field is empty. This could be filled using the manual methods described above, but it would be much easier and faster with the "Insert/Fill Columns" command.
Position the cursor in the appropriate placement of where you need to insert the data, and then select the "Insert/Fill Columns" command from the "Column" menu.
You are then prompted with a dialog box where you can input your string.
Type this in, and then press OK.
As shown in the above screenshot, UltraEdit inserts the string in the cursor-specific position on every line. If a selection had been made, the string would have been inserted into only every selected line.
Another useful feature of Column Mode is the "Insert Number" feature. This is very helpful when you need to numerically order a list of data. You can use this feature by positioning your cursor into the top row of the column where you need to add numbers. You can then select the "Insert Number" command from the "Column" menu.
If any text is highlighted at the invocation of this command, the highlighted text will be replaced by the inserted line numbers. The spacing required for the line numbers is calculated automatically based on the number of lines that will have a number inserted, the initial value and the increment.
The ensuing dialog prompts you for specifications for numbering.
First Number: The digit(s) you enter here will be the first number of the number string that is inserted. So, if you entered "10" instead of "1", the number sequence would begin "10, 11, 12..." etc.
Increment: The digit(s) you enter here determines the increment of the count. For instance, if you enter "2" here, while your "First Number" is still specified as "10", the number sequence would begin "10, 12, 14..." etc.
Leading Zeros: This option, if selected, will prepend each number with the appropriate amount of zeros to pad the field to the same width (in characters) as the maximum number. For instance, if you begin a count with "1," and set the increment to "50" with "Leading Zeros" checked, your list would begin "001, 051, 101..."
For this tutorial, we only need numbering beginning with 1 and incrementing by 1, so we will leave the default options and press "OK".
You now have a list of numbers on each line.
One way to save time and avoid error when adding column-specific data is to use the "Sum Columns/Selection" command from the "Column" menu. In our sample data below, we have some random sales figures that need to be totaled. Using the "Sum Columns/Selection" command we can total all the numbers that appear in a selected area.
You will need to first make your selection, making sure to include ALL columns that include data to be summed. With your selection still active, select the "Sum Columns/Selection" command from the "Column" menu.
The sum is calculated and then displayed in the "Sum Selected Text" dialog box.
The "Ignore character in number" allows you to specify any character that should be ignored in a number. By default, this is set to a comma. This allows you to get the sum of a column of numbers where, for example, "1000" is written as "1,000".
There are several other commands under the "Column" menu which were not covered in the above tutorial.
This command allows you to either delete or cut a specified number of columns from each row. Selecting this command will invoke a dialog that asks for a specified number of columns you would like to delete or cut. The delete or cut will begin at the current cursor position and will span the number of columns you specify. If you enter a value of 0, only the selected column will be deleted or cut.
Convert to Fixed Columns
This function allows you to convert a file from character delimited fields to fixed columns. This is particularly useful where column manipulation is required, but difficult because of different field widths for each row. This function allows you to specify separator characters and field widths. You are also given the option to "scan" the document for appropriate field widths.
Convert to Character Delimited
The opposite of "Convert to Fixed Columns," this function allows you to convert a file from fixed field widths to character delimited fields.
These functions allow you to justify a selected column of data, with the boundaries of the selection acting as the margins. Left-justifying a column of data will justify the data against the left of your selection, while right-justifying will do the opposite. Center-justifying the column of data will center the data within the selection.