Sel

Sel - the selection utility

Description

Sel is a small program to make a selection from a group of items. Sel pops up a listbox containing the items. You then choose the ones you want and click on a button. Sel will then print out only the chosen items.

Why is that useful? For example, sometimes you can choose some files using simple shell globbing patterns, like tar cf archive *.c. What do you do when a simple pattern isn't enough and you would just like to pick the files yourself? You probably don't want to do that since it would involve a lot of typing. Then sel is just the tool for you. To archive just a bunch of files you could type: tar cf archive `sel *`.

Another example: you have a directory full of MP3 music files and you want to play just some of them. Using your command-line MP3-player you would have to type the names of the files one by one. It is much faster to just do mpg123 `sel *.mp3`.

Both of the above examples have been about files, but you can use select to choose from any types of items. All the items are just strings to select.

Download

Download the v. 1.0 of sel.

Compile & Install

Sel is a Tcl script. There is no need to compile it. You just need the Tcl window shell, wish, to run it. Chances are you already have it on your system. In my Linux box, wish is in /usr/bin. If your's is in a different location, just change the first line of the sel-script to match.

Type chmod +x sel to make it executable. Install sel by copying it into some directory in your PATH.

Usage

Synopsis: sel [items...]

Sel will get the items for choosing from the command line. If the command line is empty, sel will try to read items from standard input, one item per line until stdin is closed.

Clicking the button named Select causes sel to print to standard output the highlighted items and exit.

There are two other buttons, Clear and Invert. Clear will unmark all the highlighted items. Invert will invert the set of currently selected items.

If the items contain spaces or other whitespace characters, it is often difficult to correctly pass them to a command. The example above showing how to play MP3 files would not work if the filenames contained spaces. To get around that sel can invoke the command you want directly without letting the shell mess up the file names.

There is a text box marked Command at the top of the sel window. You can make the selection of MP3 files and type mpg123 into the Command box and press Enter.

Sel supports two styles of selections. You can choose the style using the buttons at the top: Multiple and Extended. The default style is multiple, where you can make multiple selections just by clicking on items. But you have to click once on every selected item.

If you would rather make a large selection by clicking once and then dragging to the end of the selection, you can do so by first changing the select style to extended.

Author

Sami Tikka.

The idea for this program is not from me, though. I once saw a program that did something like sel but cannot remember where I saw it and who had written it.

License

The permission to use, modify and distribute this program for any purpose is granted as long as you do not make false claims of authorship.

Top of page  Front page