Before storing a command's output in the WhatsUp Gold database, it is sometimes desirable to trim content from the beginning or end of the output. For example, a command might place empty lines at the beginning or end of its output, and it might be desirable to remove these empty lines before putting the output into the database. For situations like this, several operators are provided for trimming 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 trimming 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"!" |
If multiple trimming 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