Editing WhatsConfigured command output

Before storing a command's output in the WhatsUp Gold database, it is sometimes desirable to edit the output. For example, a command might place empty lines at the beginning or end of its output, and you may want to remove these empty lines before putting the output into the database. For situations like this, several operators are provided for editing command output. These operators are specified as part of the command's KEY. For example, the following command specifies that 4 lines should be trimmed from the output of the ls –al command before the output is stored in the WhatsUp Gold database under the key, file-list.

[file-list, trim-start-lines = "4"] ls -al

The following output editing operators are provided:

Name

Value

Meaning

Example

trim-start-lines

Integer

Trim the first N lines from the commands output

trim-start-lines="1"

trim-end-lines

Integer

Trim the last N lines from the commands output

trim-end-lines="1"

trim-start

String or regular expression

Trim all output before and including the first match of the specified string or regular expression

trim-start="#\n#\n#\n"

trim-end

String or regular expression

Trim all output including and after the last match of the specified string or regular expression

trim-end="#\n#\n#\n"

trim-before

String or regular expression

Trim all output before the first match of the specified string or regular expression

trim-before="!"

trim-after

String or regular expression

Trim all output after the last match of the specified string or regular expression

trim-after"!"

remove-lines

String or regular expression

Remove all lines that match the specified string or regular expression

remove-lines=/system time.+/

If multiple editing operators are used in the same command, they are applied in the order shown in the previous table.

[file-list, trim-start-lines = "4", trim-end="\n\n\n"] ls -al

See Also

Using WhatsConfigured Commands

About commands

About basic WhatsConfigured command syntax

About strings and regular expressions in WhatsConfigured

About "$"

Storing WhatsConfigured command output in the WhatsUp Gold database

Using WhatsConfigured commands with queries

About WhatsConfigured command layout

WhatsConfigured script variables affecting command execution

About WhatsConfigured command types