File Selector Text Import



The "columns" field allows to define how text is cut out and stored in columns. Here is the grammar for this text field: the string must be a list of semi-colon separated sequences.

<sequence1>;<sequence2>;<sequence3>

Each sequence filter the text to store it in a column.

A sequence can have two forms:

  1. A number, telling how many characters to from the text before a change of column.
     
  2. A character string between quotes (" "), used as a delimiter. When this text is matched in the text, XQuad change to next column.
    You can use special characters by using the ASCII code. For example the character A can be also written \65 (decimal), \0101 (octal), \0x41 (hexadecimal). For further information, see the ASCII table in addendum.
    Some special characters can be written differently:

The character '!' at the beginning of a sequence prevents from storing the text in the column. The delimiter is still matched, thus it can be useful for skipping some part of text.

The character '*' at the beginning of a string sequence tells that the column separator is one or more times the string in the imported text.

The file cut out for each line is made at the first occurrence of the character \n (new line), or \r (carriage return) or \n\r (new line + carriage return), after the check of every sequences. You have two choices for ending the "columns" field:

Example :
Importing the file last.txt generated by the following command:

$ last > last.txt

Here is the output:

register  ttyq0        Fri Apr 12 14:45 - 14:46  (00:00)
rlogin    ttyq0        Fri Apr 12 14:45 - 14:45  (00:00)
support   ttyq0        Fri Apr 12 14:45 - 14:45  (00:00)
rlogin    ttyq0        Fri Apr 12 14:45 - 14:45  (00:00)
axene     ttyq0        Fri Apr 12 14:43 - 14:45  (00:01)
rlogin    ttyq0        Fri Apr 12 14:43 - 14:43  (00:00)
[....]
rc2                    Fri Apr 12 06:18 - 06:18  (00:00)
rc2                    Fri Apr 12 06:17 - 06:18  (00:00)
uadmin                 Fri Apr 12 06:16 - 06:17  (00:01)
echo                   Fri Apr 12 06:16 - 06:16  (00:00)
echo                   Fri Apr 12 06:16 - 06:16  (00:00)
rc0                    Fri Apr 12 06:16 - 06:16  (00:00)
rc0                    Fri Apr 12 06:16 - 06:16  (00:00)
LOGIN     console      Fri Apr 12 06:16 - 06:18  (00:02)
LOGIN     console      Thu Apr 11 06:19 - 06:16  (23:56)
getty                  Thu Apr 11 06:19 - 06:16  (23:56)
rc2                    Thu Apr 11 06:19 - 06:19  (00:00)
[....]
It can be parsed with the following string in the "columns" field:
10;13;" ";" "*;" ";" ";!"- ";" "*;!"(";")";

Explanations:
10;13;" ";" "*;" ";" ";!"- ";" "*;!"(";")";

10;13 parses the first two columns, because the first column has 10 characters and the second 13. A sequence like " "*;" "* do not work because the second columns doesn't always exist.

" ";" "*;" ";" " gets the following fields: day (Fri), month (Apr), day of the month (12), and connection time (14:14).

!"- " skips the dash between the connection time and the de-connection time.

" "* gets the de-connection time and skip the trailing spaces.

!"(" skips the open parenthesis.

")"; gets the session duration.



XQuad (c)1996-98 Axene