A perl script for maintaining notes.
note [options] [ number [,number...]]
note is a small console program written in perl, which allows you to manage notes similar to programs like \*(L"knotes\*(R" but from the commandline. Note can use different database-backends for notes-storage. It ships with a DBI-based mysql-module(which can also be used for other by \s-1DBI\s0 supported \s-1DBMS\s0), another module, which uses a binary file for storage and a \s-1DBM\s0 module. There are also two modules available which uses a text file. Note supports since version 1.0.0 encryption(\s-1IDEA\s0 or \s-1DES\s0)!
Use another config file than the default ~/.noterc.
Lists all existing notes. If no topic were specified, it will display a list of all existing topics. See the section \s-1TOPICS\s0 for details about topics.
The same as -l but prints also the timestamp of the notes.
Prints a list of all topics as a tree.
Prints the topic-tree with the notes under each topic.
Searches for <string> trough the notes database. See the section \s-1SEARCHING\s0 for details about the search engine.
Edit the note with the number <number> using your default editor or the one you specified in the config file.
Delete the note with the number <number>. You can delete multiple notes with one command. \*(L"1-4\*(R" deletes the notes 1,2,3,4. And \*(L"1,5,7\*(R" deletes the specified ones.
Dumps all notes to the textfile <file>. If <file> is a \*(L"-\*(R" it will be printed out to standard output (\s-1STDOUT\s0).
Imports a previously dumped textfile into the note database. Data will be appended by default. You can also specify a dash note -I - instead of a <file>, which causes note, silently to read in a dump from \s-1STDIN\s0.
Only suitable for use with --Import. Overwrites an existing notedb. Use with care.
Raw mode, output will not be formatted. Works not in interactive mode, only on cmd-line for list and display. That means, no colors will be used and no lines or titles.
Start note in interactive mode. See the section \s-1INTERACTIVE\s0 \s-1MODE\s0 for details on this mode.
Encrypt the given clear text string. You would need that if you want to store the mysql password not in cleartext in the config(if you are using the mysql backend!).
Display this help screen.
Display the version number.
If you run note just with one dash: note -, then it will read in a new note from \s-1STDIN\s0 until \s-1EOF\s0. This makes it possible to pipe text into a new note, i.e.:
cat sometextfile | note -
If you don't know, how to run note, try \*(L"note -h\*(R" first. It will tell you all available commandline options.
To create a new note, simply run \*(L"note\*(R". You can enter the note (the length is by default limited to 4096 bytes, which you can change from your config file if you are using the binary backend, otherwise there is no limitation). End by typing a . on a line itself. note will tell you the number of the note.
If you want to view the note, type \*(L"note 1\*(R", if the notenumber was 1.
If you want to get an overview of all notes, type \*(L"note -l\*(R". You will get a list of all notes, containing the number, the first line and the creation date. If topic-support is turned on (which is by default), then all subtopics under the current topic will be displayed first. If you want to see the timestamps, use \*(L"-L\*(R" instead of \*(L"-l\*(R". Read more about topics below in the section \*(L"Topics\*(R". You can also specify the topic which notes you want to see: \*(L"-l mytopic\*(R" does the trick. Additional, you might want to get an overview of your topic- structure. You can use the command \*(L"-t\*(R" in this case, which will display a tree-view of your topic-structure. You can use the command \*(L"-T\*(R" if you want to see the notes under each topic too. \*(L"-T\*(R" will also show the number of each note.
To edit a certain note, type \*(L"note -e 1\*(R". It will invoke your editor (vi or pico). You can edit it, after saving, note will store the changed note to the database.
Of course you can drop a certain note: \*(L"note -d 1\*(R" deletes note number 1. If a note in the middle or the beginning of the database will be deleted, note will recount the other existent notes. For example there are 3 notes, number 1, 2 and 3. If you delete number 2, then number 3 will become number 2. You can also make use of the extended delete-syntax: To delete note 1 and 2, use \*(L"-d 1,2\*(R" To delete note 1,2 and 3, use \*(L"-d 1-3\*(R".
If you cannot remember, which note you are looking for, you can use the search capability of note: \*(L"note -s <searchstring>\*(R". note will search the whole note database case insensitive for an occurence of this string and tell you the number and first- line it has.
You can extend the searchstring using \s-1AND\s0, \s-1OR\s0 ( and ) and shell-like wildcards:
$ note -s "moses AND lenin"
or:
$ note -s "(mike OR arnold) AND (jackson OR schwarzenegger)"
If note finds a note, which first line is a topic, then it will display it's second line.
These rules apply for the interactive search too.
You need to know, that note searches for the expression in every note. In other words, \*(L"moses \s-1AND\s0 lenin\*(R" searches for an occurence of \*(L"moses\*(R" and \*(L"lenin\*(R" in \s-1ONE\s0 note. Or, if you are looking for \*(L"mike \s-1OR\s0 daniel\*(R", then it searches for an occurence of \*(L"mike\*(R" or daniel\*(L" in \s-1ONE\s0 note. Thus a note with the text \*(R"mike oldfield" will match that search.
If topic-support is turned on (which is by default), the various notes are sorted under various topics. There is no special database field for the topic. Instead the topic will be stored right in the note. If the first line of your note contains some text bordered by slashes (or whatever you prefer, set \*(L"TopicSeparator\*(R" in your config! default is slash), then note will consider it as the topic of this certain note. For examle:
B</TodoList/>
If you are using topics, no data after the topic is allowed, if there is any text, note will consider it as a subtopic! Therefore, don't for- get to put a newline after the topic-line.
The list-command will only show you notes under this topic. If you create a new note, it will automagically inserted under the current topic (note will prepend the string \*(L"/topicname/\*(R" to the text of your note).
You can create at any time from any point a new topic. Just create a new note and type the name of the new topic bordered by slashes (or TopicSeparator) at the first line of this note. After saving, there will be available a new topic with one note in it.
You can create as many subtopics as you like, the format is similar to a filesystem-path. An example, say, you want to create such a structure:
(root - top level) | |----test | |----subtopic | | |--note 1 | | |--note 2 | | | |--note 4 | |--note 3
Then you may create those 4 new notes:
--- snip --- /test/subtopic/ note 1 --- snip --- /test/subtopic/ note 2 --- snip --- note 3 --- snip --- /test/ note 4 --- snip ---
I hope, you got the point ;-)
If a note does not contain the \*(L"magic\*(R" /topic/ construction on the first line, it will be listed under the \*(L"root\*(R" of note, that is the point you are at the startup of note.
You can subsequently move a note without a topic to a certain topic. Simply edit it and insert at the first line the above mentioned construction.
Note: Please don't forget the prepending and appending a slash of a topic. You will get strange results without it!
If you start note with the commandline flag -i, then it starts with an interactive interface. It will start with a listing under the default top-topic (\*(L"/\*(R"). You can enter the name of a topic to change to that topic. This works similar to a filesystem structure. The current topic will be displayed on the top of the screen.
The following commands are available:
This command lists all notes with a timestamp. If you specify a topic, it will only list the notes under this topic. If you are under a certain subtopic, then it will only display the notes under this topic.
This commands behaves similar to L but it does not display the timestamp. You can achieve the same result by simply pressing enter at any time.
You can create a new note by simply pressing N or n. You favorite editor will be started and you can enter your note text. If you are already under a topic then this new note will automatically go to this topic. note adds an additional line to the top of the note with the topic. But you can of course specify your own topic. Note will tell you which number it has assigned to the newly created note.
By entering E or e and a note-number you can edit an existing note using your favorite editor. This way you can also move an existing note from one topic to another one by editing the first line of the note.
E or e deletes one or more existing note(s). It requires a note number or a set of note numbers. 1-5 and 1,7,9 are possible values. After one or more notes has been deleted note will recount all remaining notes. Say if you delete 1 and 2, then 3 will become 1, 4 will become 5 and so forth.
You can search for the occurence of a text in your notes-database with the command S or s. If you omit an expression note will ask you for one. If your search criteria matches on exactly one entry, note will display that note entry instead of displaying its number.
This prints a tree-view of your topic-structure. T displays the tree with notes, t displays just the topics without notes.
It is possible to change note's behavior at runtime. Specify the parameter you'd like to modify followed by equalsign and the new value. Use with care! However, database related parameters cannot be changed at runtime. Entering just \*(L"c\*(R" without parameters displays the customizable variables.
Change the actual topic under which you are. This works identical like just entering the topic but it has some advantages. You can enter cd .. if you want to go one level up in the topic-structure. And you can enter cd / to go to the top of the structure. You can always leave out the 'cd' keyword too. Additional it is possible to enter a note-number instead of a topic name. For this feature to be active you need to set the config option ShortCd to 1 or yes. If you use a number and the note with this number is under a certain topic then you will \*(L"cd\*(R" to this topic. This allows you to do kind of jumps over multiple levels of topics. If is possible to abbreviate a topic. This works only if the abbreviation matches on one single topic. If it matches more than one topic then the available ones will be suggested.
Display a short help screen.
Quit note.
You can also dump the contents of your note-database into a ASCII-textfile(-D). You can use this file later to import it into your note-database(-I). This is useful, if you want quickly trans- fer your notes from one host to another (i.e. you could mail your note-dump form your office to home and import it there for further use).
The dumps from the two versions of note are in the same format. Using dumps it is also possible to reinitialize your database. You can use the \*(L"-o\*(R" switch whcih causes note to overwrite your existing database. This is very handy if you changed heavily your config. And it is required, if you changed: encryption, db-driver, (binary-format) and the password. You can use the following command for reinitializing:
$ note -D - | note -o -I -
What the hell, does this do?! Step by step:
note -D - creates a note-database dump and prints it out to stantdard output.
| this is the shell's pipe command. It takes the output of the left program and gives it to the right program as standard input.
note -o -I - imports a note-database dump from standard input and overwrites an existing database.
Before you use the -o switch, I consider you to make a backup!
Another very nice feature is the possibility to format the note-text (as much as shell allows it). First, you can use the note-internal \*(L"magic-strings\*(R" for colorizing. Those strings looks much like \s-1HTML:\s0 \*(L"<green>here is a green line of text</green> no more green.\*(R" As you see, the beginning of another color starts with a tag(kinda) of the color <colorname> and ends with an end tag </colorname>.
The following colors are available: black, red, green, yellow, blue, magenta, cyan and white.
Beside colorizing text, you can also create bold or underlined text! If you decide to use this (additional) feature, you need to set the Config-Option \*(L"FormatText\*(R" to 1 which turns it on. Usage is very straightforward, if a word (a word is defined as some text with at least one space surrounded) is between a magic mark- character. Here are the available things, you can do:
bold: **word** underlined: _\|_word_\|_ inverse: {{word}} hidden: //word//
The text will be formatted using the actually note-color.
The hidden formatting will use blue forground and blue background to hide a string from the terminal, which is useful for passwords.
If you set \*(L"FormatText\*(R" to simple then the formatting can be done this way instead:
bold: *word* underlined: _word_ inverse: {word} hidden: /word/
You can turn on encryption from the config file. Simply set UseEncryption to 1. Please note, that you need to decide, if you want to use encryption before the first use of note! If have already a note database and want to \*(L"migrate\*(R" to encryption, I suggest you to follow the directions in the file \s-1UPGRADE\s0!
You can choose from different encryption algorythms. The default is \s-1IDEA\s0, but \s-1DES\s0 or \s-1BLOWFISH\s0 are also possible. You need to have installed the following additional perl-modules on your system: \s-1MD5\s0 Crypt::IDEA Crypt::DES Crypt::CBC
After turning on encryption, note will ask you for a passphrase everytime it runs! It will *not* store this passphrase! So, don't forget it! Be careful!
You can use a configuration file with note but it is not required. Note will use default values if there is no config.
The default config file is ~/.noterc. You may specify another one with the commandline flag --config.
Comments start with #, empty lines will be ignored.
To turn on an option, set it to: 1, on or yes.
To turn off an option, set it to: 0, off or no.
An option consists of an atribute-value pair separated by minimum one space (more spaces and/or tabs are allowed) and an optional equal sign in between.
Variable names are case in-sensitive.
For a detailed explanation of each possible parameter take a look at the supplied sample configuration file in config/noterc.
Thomas Linden <tom at linden dot at>
1.3.6 (07/20/2009)