TQL - TextQueryLanguage


TQL is a query language designed for flat text.

Getting started

1) Download the TQL.jar File.

2) Klick on the file to run TQL in GUI Mode or type java -jar TQL.jar console to run TQL in the terminal.

3) Create a new TQL File using the CREATE command. Easiest Usage: CREATE example CHOOSER

4) Select the file with USE example

System Commands


Used to load data or create text sources.

Syntax: CREATE <name> <mode> <args>


Possible usages:


CREATE example FILE /path/to/file.txt -> Loads a file.

CREATE example CHOOSER -> Shows a file chooser dialog to select a file and load it.

CREATE example URL http://example.com/file.txt -> Loads a file from the web-

CREATE example EMPTY -> Creates a empty text source.

CREATE example INPUT Example Text! -> Creates a text source with the given content.


Returns: The name of the created source.



Sets the main text source to use. You can use multiple sources using the (WITH) command.


Possible usages:

USE example -> Selects the given source.


Returns: The name of the selected source.




Deletes a text source. Delete large loaded sources to get more memory.


Possible usages:

DELETE example -> Deletes the given source


Returns: The name of the deleted source.




Refreshes the current text source. This works only if the source is loaded from file or url.


Possible usages:



Returns: The name of the source.




Lists all existing sources and shows the one that is selected.


Possible usages:



Returns: A formatted list with all source names.






Language commands


Used to get content from a source.


Possible usages:


(GET) -> The same as (GET LINE). Returns the whole source text.

(GET LINE) -> Returns all lines.

(GET LINE <condition>) -> Returns all lines that match a given condition.

(GET WORD) -> Returns all words.

(GET WORD <condition>) -> Returns all words that match a condition.

(GET CHAR) -> Returns all characters.

(GET CHAR <condition>) -> Returns all characters that match a condition.




Used to remove double results.


Possible usages:

(DISTINCT <command>)


Example (Get all different words from the source):





Returns the number of returned results.


Possible usages:

(COUNT <command>)


Example (Count characters in the source):





Returns the result with the given index.


Possible usages:

(INDEX <index>|<command>) -> Gets the result with a static index.

(INDEX <index-command>|<main-command>) -> Gets the index from a command result.


Example (Returns the fifth word from the source):





Runs a command without returning the results.


Possible usages:

(SILENT <command>) 



Lists all yaml keys that can be used to get a property.


Possible usages:





Used to change the text source.


Possible usages:

(LINE ALL <Text or command>) -> Sets the whole text to the given content.

(LINE END <Text or command>) -> Appends the given text at the end.




Used to use a other source than the selected one for the sub-commands.


Possible usages:

(SOURCE <source>|<command>) -> Execute the command with the given source.

(SOURCE <name-command>|<command>) -> Executes the command to receive the source name.


Example (Get a property with the key name from another file):

(PROPERTY (SOURCE keydata|(PROPERTY example-key)))




Uses a text or a return value as source for the sub-commands.


Possible usages:

(WITH <text>|<command>) -> Executes the command on the given text.

(WITH <text-command>|<command>) -> Additionally executes a command to receives the source text.


Example (Get all characters of "Hello world"):

(WITH Hello world|(GET WORD)







Calculation commands:


(+ <command1>|<command2>)

(- <command1>|command2>)

(* <command1>|<command2>)

(/ <command1>|<command2>)


Text utility commands:


(SPACE) -> Returns a space character.

(SPACE <amount>) -> Returns the given amount of space characters.




- All commands have to be written in upper case.

- Language commands are surrounded with ( and ).

- Multiple command can be combined to one string with < and >

- Run multiple command in one line with splitting them with semicolons.


- Use {nl} for multiple lines. Example:

Hello!{nl}Are you all right?



Are you all right?



Get all lines that contain "hello" or "hi":



Count how often the text contains "hello":



Count how many different characters the text contains: