Customizing the Options File


The $HOME Directory

Before you can edit the options file, you must first locate it by figuring out what your home directory is. If you do not know what you home directory is, type the following at your command prompt.

$ > echo $HOME
/home/wesb
In this case, /home/wesb is the home directory. If you haven't already done so, switch into your home directory now.
$ cd $HOME

The tkWorld Directory

Now that you are home, you can switch into the tkWorld directory. First lets find all the files which begin with .tk so we can figure out what is your tkWorld directory.

.tkWorld-0.03:
total 14
drwx------   2 wesb     wesb         1024 May  7 20:08 ./
drwxr-xr-x  41 wesb     wesb         3072 May 21 20:11 ../
-rw-------   1 wesb     wesb         2922 May  7 20:08 .tkSortrc
-rw-------   1 wesb     wesb         2922 May  7 20:08 .tkSortrc.old
-rw-------   1 wesb     wesb          970 May  7 20:03 .tkSortrc
-rw-------   1 wesb     wesb          970 May  7 20:03 .tkSortrc.old
-rw-------   1 wesb     wesb          769 May 13 21:33 tkSort.ex
-rw-------   1 wesb     wesb           40 May 11 21:15 tkSort.ex

.tkWorld-0.04:
total 14
drwx------   2 wesb     wesb         1024 May 12 18:02 ./
drwxr-xr-x  41 wesb     wesb         3072 May 21 20:11 ../
-rw-------   1 wesb     wesb         2922 May  7 21:48 .tkSortrc
-rw-------   1 wesb     wesb         2922 May  7 21:48 .tkSortrc.old
-rw-------   1 wesb     wesb          970 May 12 18:02 .tkSortrc
-rw-------   1 wesb     wesb          970 May 12 18:02 .tkSortrc.old
-rw-------   1 wesb     wesb          769 May 21 21:15 tkSort.ex
-rw-------   1 wesb     wesb           40 May 18 22:14 tkSort.ex

In this example, there is a directory called .tkWorld-0.04 which has several files in it. First off, the dot (.) is the first character in the directory name. This means that the directory is hidden from simple directory listings like ls. Consult a Unix/Linux Operating System book for a technical definition of the directory structure and the role of hidden files.

What do the numbers in .tkWorld-0.04 mean? The first one after the dash indicates the current release (distribution), in this case zero since tkWorld is not finished yet. The numbers after the second dot point out how many tools are available in the tkWorld release that you have. The figure below summarizes the numbers.

How did this directory and it's files get created? After launching tkSort for the first time, it checks if they already exist. Since they do not, the application creates the .tkWorld-0.04 directory, as well as the default application files. In the current example, there are three files in the tkWorld directory.

The first file is the options file which you can customize. The second file, .tkSortrc.old, is a backup of the original options file which can be used to restore tkSort to it's default behavior. The last file is the example file that the application defaults to using when no filenames are given at runtime.

The .tkSortrc File

The section below lists a few rules which define the layout of the .tkSortrc file.

Option File Rules

  1. Comments begin with the pound sign (#).
  2. The colon (:) is the option delimiter.
  3. The Label String is on the left of the colon.
  4. The Command Line Option is on the right of the colon.
  5. Options must be on separate lines.

Lets look at an example. The following line is un-commented in the options file

-n:Compare fields as numbers, not strings.
The Compare fields as numbers, not strings. is the label string which appears in the Wizard Helpand is on the right side of the colon. The -n is a sort Command Line Option and is on the left side of the colon. When tkSort is run, the above line produces the following Command Center option button.

The default un-commented option lines are listed below.

  1. -c:Check whether files are already sorted.
  2. -m:Merge files and sort them as a group.
  3. -b:Ignore leading blanks when finding sort keys.
  4. -d:Ignore all chars except a-z, 0-9, and blanks.
  5. -f:Case insensitive sort (meaning a=A).
  6. -i:Ignore characters outside the ASCII range.
  7. -n:Compare fields as numbers, not strings.
  8. -r:Display sorted records in reverse order.

Customizing the file can be done by removing the comment from (adding a comment to) any option that you want to appear (or not appear) in the interface. Original user options can also be added in the options file too. For example, if you find that you are always using the Compare fields as numbers, Display sorted records in reverse order, and using column 2, you could define the following

 
-nk2:My Own Favorite Option
in the .tkSortrc file. This customization changes the Command Center display the next time the application is run. The figure below illustrates the changes.

The Wizard Help messages should also be as follows:

Notice that the -v:Print Line Number In File appears before -Ein:My Own Favorite Option. This brings up the final point that Command Center option buttons in the order they are encountered in the .tkSortrc file. In this particular case, the new customization was added at the end of the options file.

Reminder!

To find all the Command Line Options for sort at your site, type man sort at your shell prompt.


Index