|
|
|
|
|
[1m[35mlnav[0m
|
|
|
|
|
|
A fancy log file viewer for the terminal.
|
|
|
|
|
|
[1mOverview[0m
|
|
|
|
|
|
The Logfile Navigator, [1mlnav[0m, is an enhanced log file viewer that takes
|
|
|
advantage of any semantic information that can be gleaned from the
|
|
|
files being viewed, such as timestamps and log levels. Using this
|
|
|
extra semantic information, lnav can do things like interleaving
|
|
|
messages from different files, generate histograms of messages over
|
|
|
time, and providing hotkeys for navigating through the file. It is
|
|
|
hoped that these features will allow the user to quickly and
|
|
|
efficiently zero in on problems.
|
|
|
|
|
|
[1mOpening Paths/URLs[0m
|
|
|
|
|
|
The main arguments to lnav are the local/remote files, directories,
|
|
|
glob patterns, or URLs to be viewed. If no arguments are given, the
|
|
|
default syslog file for your system will be opened. These arguments
|
|
|
will be polled periodically so that any new data or files will be
|
|
|
automatically loaded. If a previously loaded file is removed or
|
|
|
replaced, it will be closed and the replacement opened.
|
|
|
|
|
|
Note: When opening SFTP URLs, if the password is not provided for the
|
|
|
host, the SSH agent can be used to do authentication.
|
|
|
|
|
|
[1mOptions[0m
|
|
|
|
|
|
Lnav takes a list of files to view and/or you can use the flag
|
|
|
arguments to load well-known log files, such as the syslog log files.
|
|
|
The flag arguments are:
|
|
|
|
|
|
[33m•[0m [37m[40m -a [0m Load all of the most recent log file types.
|
|
|
[33m•[0m [37m[40m -r [0m Recursively load files from the given directory
|
|
|
hierarchies.
|
|
|
[33m•[0m [37m[40m -R [0m Load older rotated log files as well.
|
|
|
|
|
|
When using the flag arguments, lnav will look for the files relative
|
|
|
to the current directory and its parent directories. In other words,
|
|
|
if you are working within a directory that has the well-known log
|
|
|
files, those will be preferred over any others.
|
|
|
|
|
|
If you do not want the default syslog file to be loaded when no files
|
|
|
are specified, you can pass the [37m[40m -N [0m flag.
|
|
|
|
|
|
Any files given on the command-line are scanned to determine their log
|
|
|
file format and to create an index for each line in the file. You do
|
|
|
not have to manually specify the log file format. The currently
|
|
|
supported formats are: syslog, apache, strace, tcsh history, and
|
|
|
generic log files with timestamps.
|
|
|
|
|
|
Lnav will also display data piped in on the standard input.
|
|
|
|
|
|
To automatically execute queries or lnav commands after the files have
|
|
|
been loaded, you can use the following options:
|
|
|
|
|
|
[33m•[0m [37m[40m -c cmd [0m A command, query, or file to execute. The
|
|
|
first character determines the type of operation: a colon
|
|
|
([37m[40m : [0m) is used for the built-in commands; a semi-colon (
|
|
|
[37m[40m ; [0m) for SQL queries; and a pipe symbol ([37m[40m | [0m) for
|
|
|
executing a file containing other commands. For example,
|
|
|
to open the file "foo.log" and go to the tenth line in
|
|
|
the file, you can do:
|
|
|
|
|
|
▌[37m[40mlnav -c [0m[35m[40m':goto 10'[0m[37m[40m foo.log [0m
|
|
|
|
|
|
This option can be given multiple times to execute
|
|
|
multiple operations in sequence.
|
|
|
[33m•[0m [37m[40m -f file [0m A file that contains commands, queries, or
|
|
|
files to execute. This option is a shortcut for
|
|
|
[37m[40m -c '|file' [0m. You can use a dash ([37m[40m - [0m) to execute
|
|
|
commands from the standard input.
|
|
|
|
|
|
To execute commands/queries without opening the interactive text UI,
|
|
|
you can pass the [37m[40m -n [0m option. This combination of options allows you
|
|
|
to write scripts for processing logs with lnav. For example, to get a
|
|
|
list of IP addresses that dhclient has bound to in CSV format:
|
|
|
|
|
|
▌[32m[40m#! /usr/bin/lnav -nf [0m
|
|
|
▌[37m[40m [0m
|
|
|
▌[32m[40m# Usage: dhcp_ip.lnav /var/log/messages [0m
|
|
|
▌[32m[40m# Only include lines that look like: [0m
|
|
|
▌[32m[40m# Apr 29 00:31:56 example-centos5 dhclient: bound to 10.1.10.103 -- renewal in 9938 seconds. [0m
|
|
|
▌[37m[40m [0m
|
|
|
▌[37m[40m:[0m[1m[36m[40mfilter-in[0m[37m[40m dhclient: bound to [0m
|
|
|
▌[37m[40m [0m
|
|
|
▌[32m[40m# The log message parser will extract the IP address [0m
|
|
|
▌[32m[40m# as col_0, so we select that and alias it to "dhcp_ip". [0m
|
|
|
▌[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[36m[40mDISTINCT[0m[37m[40m [0m[37m[40mcol_0[0m[37m[40m [0m[1m[36m[40mAS[0m[37m[40m [0m[37m[40mdhcp_ip[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlogline[0m[37m[40m; [0m
|
|
|
▌[37m[40m [0m
|
|
|
▌[32m[40m# Finally, write the results of the query to stdout. [0m
|
|
|
▌[37m[40m:[0m[1m[36m[40mwrite-csv-to[0m[37m[40m - [0m
|
|
|
|
|
|
[1mDisplay[0m
|
|
|
|
|
|
The main part of the display shows the log lines from the files
|
|
|
interleaved based on time-of-day. New lines are automatically loaded
|
|
|
as they are appended to the files and, if you are viewing the bottom
|
|
|
of the files, lnav will scroll down to display the new lines, much
|
|
|
like [37m[40m tail -f [0m.
|
|
|
|
|
|
On color displays, the lines will be highlighted as follows:
|
|
|
|
|
|
[33m•[0m Errors will be colored in [31mred[0m;
|
|
|
[33m•[0m warnings will be [33myellow[0m;
|
|
|
[33m•[0m boundaries between days will be [4munderlined[0m;
|
|
|
and
|
|
|
[33m•[0m various color highlights will be applied to: IP
|
|
|
addresses, SQL keywords, XML tags, file and line numbers
|
|
|
in Java backtraces, and quoted strings.
|
|
|
|
|
|
To give you an idea of where you are spatially, the right side of the
|
|
|
display has a proportionally sized 'scroll bar' that indicates your
|
|
|
current position in the files. The scroll bar will also show areas of
|
|
|
the file where warnings or errors are detected by coloring the bar
|
|
|
yellow or red, respectively. Tick marks will also be added to the left
|
|
|
and right-hand side of the bar, for search hits and bookmarks.
|
|
|
|
|
|
The bar on the left side indicates the file the log message is from. A
|
|
|
break in the bar means that the next log message comes from a
|
|
|
different file. The color of the bar is derived from the file name.
|
|
|
Pressing the left-arrow or [37m[40m h [0m will reveal the source file names for
|
|
|
each message and pressing again will show the full paths.
|
|
|
|
|
|
Above and below the main body are status lines that display a variety
|
|
|
of information. The top line displays:
|
|
|
|
|
|
[33m•[0m The current time, configurable by the
|
|
|
[37m[40m /ui/clock-format [0m property.
|
|
|
[33m•[0m The highest priority message from the
|
|
|
[37m[40m lnav_user_notifications [0m table. You can insert rows into
|
|
|
this table to display your own status messages. The
|
|
|
default message displayed on startup explains how to
|
|
|
focus on the next status line at the top, which is an
|
|
|
interactive breadcrumb bar.
|
|
|
|
|
|
The second status line at the top display breadcrumbs for the top line
|
|
|
in the main view. Pressing [37m[40m ENTER [0m will focus input on the breadcrumb
|
|
|
bar, the cursor keys can be used to select a breadcrumb. The common
|
|
|
breadcrumbs are:
|
|
|
|
|
|
[33m•[0m The name of the current view.
|
|
|
[33m•[0m In the log view, the timestamp of the top log message.
|
|
|
[33m•[0m In the log view, the format of the log file the top
|
|
|
log message is from.
|
|
|
[33m•[0m The name of the file the top line was pulled from.
|
|
|
[33m•[0m If the top line is within a larger chunk of structured
|
|
|
data, the path to the value in the top line will be
|
|
|
shown.
|
|
|
|
|
|
Notes:
|
|
|
|
|
|
[33m1.[0m Pressing [37m[40m CTRL-A [0m/[37m[40m CTRL-E [0m will select the
|
|
|
first/last breadcrumb.
|
|
|
[33m2.[0m Typing text while a breadcrumb is selected will
|
|
|
perform a fuzzy search on the possibilities.
|
|
|
|
|
|
The bottom status bar displays:
|
|
|
|
|
|
[33m•[0m The line number for the top line in the display.
|
|
|
[33m•[0m The current search hit, the total number of hits, and
|
|
|
the search term.
|
|
|
|
|
|
If the view supports filtering, there will be a status line showing
|
|
|
the following:
|
|
|
|
|
|
[33m•[0m The number of enabled filters and the total number of
|
|
|
filters.
|
|
|
[33m•[0m The number of lines not displayed because of
|
|
|
filtering.
|
|
|
|
|
|
To edit the filters, you can press TAB to change the focus from the
|
|
|
main view to the filter editor. The editor allows you to create,
|
|
|
enable/disable, and delete filters easily.
|
|
|
|
|
|
Along with filters, a "Files" panel will also be available for viewing
|
|
|
and controlling the files that lnav is currently monitoring.
|
|
|
|
|
|
Finally, the last line on the display is where you can enter search
|
|
|
patterns and execute internal commands, such as converting a
|
|
|
unix-timestamp into a human-readable date. The command-line is
|
|
|
implemented using the readline library, so the usual set of keyboard
|
|
|
shortcuts are available. Most commands and searches also support
|
|
|
tab-completion.
|
|
|
|
|
|
The body of the display is also used to display other content, such
|
|
|
as: the help file, histograms of the log messages over time, and SQL
|
|
|
results. The views are organized into a stack so that any time you
|
|
|
activate a new view with a key press or command, the new view is
|
|
|
pushed onto the stack. Pressing the same key again will pop the view
|
|
|
off of the stack and return you to the previous view. Note that you
|
|
|
can always use [37m[40m q [0m to pop the top view off of the stack.
|
|
|
|
|
|
[1mDefault Key Bindings[0m
|
|
|
|
|
|
[4mViews[0m
|
|
|
|
|
|
Key(s) Action
|
|
|
═══════════════════════════════════════════════════════════
|
|
|
[1m?[0m View/leave this help message.
|
|
|
[1mq[0m Leave the current view or quit the program when in
|
|
|
the log file view.
|
|
|
Q Similar to [37m[40m q [0m, except it will try to sync the top
|
|
|
time between the current and former views. For
|
|
|
example, when leaving the spectrogram view with
|
|
|
[37m[40m Q [0m, the top time in that view will be matched to
|
|
|
the top time in the log view.
|
|
|
TAB Toggle focusing on the filter editor or the main
|
|
|
view.
|
|
|
ENTER Focus on the breadcrumb bar.
|
|
|
a/A Restore the view that was previously popped with
|
|
|
[37m[40m q [0m/[37m[40m Q [0m. The [37m[40m A [0m hotkey will try to match the top
|
|
|
times between the two views.
|
|
|
X Close the current text file or log file.
|
|
|
|
|
|
[4mSpatial Navigation[0m
|
|
|
|
|
|
Key(s) Action
|
|
|
═══════════════════════════════════════════════════════════════
|
|
|
g/Home Move to the top of the file.
|
|
|
G/End Move to the end of the file. If the view is
|
|
|
already at the end, it will move to the last line.
|
|
|
SPACE/PgDn Move down a page.
|
|
|
CTRL+d Move down by half a page.
|
|
|
b/PgUp Move up a page.
|
|
|
CTRL+u Move up by half a page.
|
|
|
j/↓ Move down a line.
|
|
|
k/↑ Move up a line.
|
|
|
h/← Move to the left. In the log view, moving left
|
|
|
will reveal the source log file names for each
|
|
|
line. Pressing again will reveal the full path.
|
|
|
l/→ Move to the right.
|
|
|
H/Shift ← Move to the left by a smaller increment.
|
|
|
L/Shift → Move to the right by a smaller increment.
|
|
|
e/E Move to the next/previous error.
|
|
|
w/W Move to the next/previous warning.
|
|
|
n/N Move to the next/previous search hit. When pressed
|
|
|
repeatedly within a short time, the view will move
|
|
|
at least a full page at a time instead of moving
|
|
|
to the next hit.
|
|
|
f/F Move to the next/previous file. In the log view,
|
|
|
this moves to the next line from a different file.
|
|
|
In the text view, this rotates the view to the
|
|
|
next file.
|
|
|
>/< Move horizontally to the next/previous search hit.
|
|
|
o/O Move forward/backward to the log message with a
|
|
|
matching 'operation ID' (opid) field.
|
|
|
u/U Move forward/backward through any user bookmarks
|
|
|
you have added using the 'm' key. This hotkey will
|
|
|
also jump to the start of any log partitions that
|
|
|
have been created with the 'partition-name'
|
|
|
command.
|
|
|
s/S Move to the next/previous "slow down" in the log
|
|
|
message rate. A slow down is detected by measuring
|
|
|
how quickly the message rate has changed over the
|
|
|
previous several messages. For example, if one
|
|
|
message is logged every second for five seconds
|
|
|
and then the last message arrives five seconds
|
|
|
later, the last message will be highlighted as a
|
|
|
slow down.
|
|
|
{/} Move to the previous/next location in history.
|
|
|
Whenever you jump to a new location in the view,
|
|
|
the location will be added to the history. The
|
|
|
history is not updated when using only the arrow
|
|
|
keys.
|
|
|
|
|
|
[4mChronological Navigation[0m
|
|
|
|
|
|
Key(s) Action
|
|
|
══════════════════════════════════════════════════════════════════
|
|
|
d/D Move forward/backward 24 hours from the current
|
|
|
position in the log file.
|
|
|
1-6/Shift 1-6 Move to the next/previous n'th ten minute of the
|
|
|
hour. For example, '4' would move to the first log
|
|
|
line in the fortieth minute of the current hour in
|
|
|
the log. And, '6' would move to the next hour
|
|
|
boundary.
|
|
|
7/8 Move to the previous/next minute.
|
|
|
0/Shift 0 Move to the next/previous day boundary.
|
|
|
r/R Move forward/backward based on the relative time
|
|
|
that was last used with the 'goto' command. For
|
|
|
example, executing ':goto a minute later' will
|
|
|
move the log view forward a minute and then
|
|
|
pressing 'r' will move it forward a minute again.
|
|
|
Pressing 'R' will then move the view in the
|
|
|
opposite direction, so backwards a minute.
|
|
|
|
|
|
[4mBookmarks[0m
|
|
|
|
|
|
Key(s) Action
|
|
|
═══════════════════════════════════════════════════════════
|
|
|
m Mark/unmark the line at the top of the display.
|
|
|
The line will be highlighted with reverse video to
|
|
|
indicate that it is a user bookmark. You can use
|
|
|
the [37m[40m u [0m hotkey to iterate through marks you have
|
|
|
added.
|
|
|
M Mark/unmark all the lines between the top of the
|
|
|
display and the last line marked/unmarked.
|
|
|
J Mark/unmark the next line after the previously
|
|
|
marked line.
|
|
|
K Like [37m[40m J [0m except it toggles the mark on the
|
|
|
previous line.
|
|
|
c Copy the marked text to the X11 selection buffer
|
|
|
or OS X clipboard.
|
|
|
C Clear all marked lines.
|
|
|
|
|
|
[4mDisplay options[0m
|
|
|
|
|
|
Key(s) Action
|
|
|
══════════════════════════════════════════════════════════════════
|
|
|
P Switch to/from the pretty-printed view of the log
|
|
|
or text files currently displayed. In this view,
|
|
|
structured data, such as XML, will be reformatted
|
|
|
to make it easier to read.
|
|
|
t Switch to/from the text file view. The text file
|
|
|
view is for any files that are not recognized as
|
|
|
log files.
|
|
|
= Pause/unpause loading of new file data.
|
|
|
Ctrl-L (Lo-fi mode) Exit screen-mode and write the
|
|
|
displayed log lines in plain text to the terminal
|
|
|
until a key is pressed. Useful for copying long
|
|
|
lines from the terminal without picking up any of
|
|
|
the extra decorations.
|
|
|
T Toggle the display of the "elapsed time" column
|
|
|
that shows the time elapsed since the beginning of
|
|
|
the logs or the offset from the previous bookmark.
|
|
|
Sharp changes in the message rate are highlighted
|
|
|
by coloring the separator between the time column
|
|
|
and the log message. A red highlight means the
|
|
|
message rate has slowed down and green means it
|
|
|
has sped up. You can use the "s/S" hotkeys to scan
|
|
|
through the slow downs.
|
|
|
i View/leave a histogram of the log messages over
|
|
|
time. The histogram counts the number of displayed
|
|
|
log lines for each bucket of time. The bars are
|
|
|
layed out horizontally with colored segments
|
|
|
representing the different log levels. You can use
|
|
|
the [37m[40m z [0m hotkey to change the size of the time
|
|
|
buckets (e.g. ten minutes, one hour, one day).
|
|
|
I Switch between the log and histogram views while
|
|
|
keeping the time displayed at the top of each view
|
|
|
in sync. For example, if the top line in the log
|
|
|
view is "11:40", hitting [37m[40m I [0m will switch to the
|
|
|
histogram view and scrolled to display "11:00" at
|
|
|
the top (if the zoom level is hours).
|
|
|
z/Shift Z Zoom in or out one step in the histogram view.
|
|
|
v Switch to/from the SQL result view.
|
|
|
V Switch between the log and SQL result views while
|
|
|
keeping the top line number in the log view in
|
|
|
sync with the log_line column in the SQL view. For
|
|
|
example, doing a query that selects for
|
|
|
"log_idle_msecs" and "log_line", you can move the
|
|
|
top of the SQL view to a line and hit 'V' to
|
|
|
switch to the log view and move to the line number
|
|
|
that was selected in the "log_line" column. If
|
|
|
there is no "log_line" column, lnav will find the
|
|
|
first column with a timestamp and move to
|
|
|
corresponding time in the log view.
|
|
|
TAB/Shift TAB In the SQL result view, cycle through the columns
|
|
|
that are graphed. Initially, all number values are
|
|
|
displayed in a stacked graph. Pressing TAB will
|
|
|
change the display to only graph the first column.
|
|
|
Repeatedly pressing TAB will cycle through the
|
|
|
columns until they are all graphed again.
|
|
|
p In the log view: enable or disable the display of
|
|
|
the fields that the log message parser knows about
|
|
|
or has discovered. This overlay is temporarily
|
|
|
enabled when the semicolon key (;) is pressed so
|
|
|
that it is easier to write queries.
|
|
|
In the DB view: enable or disable the display of
|
|
|
values in columns containing JSON-encoded values
|
|
|
in the top row. The overlay will display the
|
|
|
JSON-Pointer reference and value for all fields in
|
|
|
the JSON data.
|
|
|
CTRL-W Toggle word-wrapping.
|
|
|
CTRL-P Show/hide the data preview panel that may be
|
|
|
opened when entering commands or SQL queries.
|
|
|
CTRL-F Toggle the enabled/disabled state of all filters
|
|
|
in the current view.
|
|
|
x Toggle the hiding of log message fields. The
|
|
|
hidden fields will be replaced with three bullets
|
|
|
and highlighted in yellow.
|
|
|
CTRL-X Toggle the cursor mode. Allows moving the selected
|
|
|
line instead of keeping it fixed at the top of the
|
|
|
current screen.
|
|
|
F2 Toggle mouse support.
|
|
|
|
|
|
[4mQuery[0m
|
|
|
|
|
|
Key(s) Action
|
|
|
════════════════════════════════════════════════════════════════════════
|
|
|
[1m/[0m[4mregexp[0m Start a search for the given regular expression.
|
|
|
The search is live, so when there is a pause in
|
|
|
typing, the currently running search will be
|
|
|
canceled and a new one started. The first ten
|
|
|
lines that match the search will be displayed in
|
|
|
the preview window at the bottom of the view.
|
|
|
History is maintained for your searches so you can
|
|
|
rerun them easily. Words that are currently
|
|
|
displayed are also available for tab-completion,
|
|
|
so you can easily search for values without
|
|
|
needing to copy-and-paste the string. If there is
|
|
|
an error encountered while trying to interpret the
|
|
|
expression, the error will be displayed in red on
|
|
|
the status line. While the search is active, the
|
|
|
'hits' field in the status line will be green,
|
|
|
when finished it will turn back to black.
|
|
|
[1m:[0m<command> Execute an internal command. The commands are
|
|
|
listed below. History is also supported in this
|
|
|
context as well as tab-completion for commands and
|
|
|
some arguments. The result of the command replaces
|
|
|
the command you typed.
|
|
|
[1m;[0m<sql> Execute an SQL query. Most supported log file
|
|
|
formats provide a sqlite virtual table backend
|
|
|
that can be used in queries. See the SQL section
|
|
|
below for more information.
|
|
|
[1m|[0m<script> [arg1...] Execute an lnav script contained in a format
|
|
|
directory (e.g. ~/.lnav/formats/default). The
|
|
|
script can contain lines starting with [37m[40m : [0m, [37m[40m ; [0m,
|
|
|
or [37m[40m | [0m to execute commands, SQL queries or execute
|
|
|
other files in lnav. Any values after the script
|
|
|
name are treated as arguments can be referenced in
|
|
|
the script using [37m[40m $1 [0m, [37m[40m $2 [0m, and so on, like in a
|
|
|
shell script.
|
|
|
CTRL+], ESCAPE Abort command-line entry started with [37m[40m / [0m, [37m[40m : [0m,
|
|
|
[37m[40m ; [0m, or [37m[40m | [0m.
|
|
|
|
|
|
▌[1mNote[0m: The regular expression format used by lnav is ]8;;http://perldoc.perl.org/perlre.html\[4mPCRE[0m]8;;\[4m[1][0m
|
|
|
▌(Perl-Compatible Regular Expressions).
|
|
|
▌
|
|
|
▌ ▌[1] - http://perldoc.perl.org/perlre.html
|
|
|
▌
|
|
|
▌If the search string is not valid PCRE, a search is done for
|
|
|
▌the exact string instead of doing a regex search.
|
|
|
|
|
|
[1mSession[0m
|
|
|
|
|
|
Key(s) Action
|
|
|
═══════════════════════════════════════════════════════════
|
|
|
CTRL-R Reset the session state. This will save the
|
|
|
current session state (filters, highlights) and
|
|
|
then reset the state to the factory default.
|
|
|
|
|
|
[1mFilter Editor[0m
|
|
|
|
|
|
The following hotkeys are only available when the focus is on the
|
|
|
filter editor. You can change the focus by pressing TAB.
|
|
|
|
|
|
Key(s) Action
|
|
|
═══════════════════════════════════════════════════════════
|
|
|
q Switch the focus back to the main view.
|
|
|
j/↓ Select the next filter.
|
|
|
k/↑ Select the previous filter.
|
|
|
o Create a new "out" filter.
|
|
|
i Create a new "in" filter .
|
|
|
SPACE Toggle the enabled/disabled state of the currently
|
|
|
selected filter.
|
|
|
t Toggle the type of filter between "in" and "out".
|
|
|
ENTER Edit the selected filter.
|
|
|
D Delete the selected filter.
|
|
|
|
|
|
[1mMouse Support (experimental)[0m
|
|
|
|
|
|
If you are using Xterm, or a compatible terminal, you can use the
|
|
|
mouse to mark lines of text and move the view by grabbing the
|
|
|
scrollbar.
|
|
|
|
|
|
NOTE: You need to manually enable this feature by setting the LNAV_EXP
|
|
|
environment variable to "mouse". F2 toggles mouse support.
|
|
|
|
|
|
[1mSQL Queries (experimental)[0m
|
|
|
|
|
|
Lnav has support for performing SQL queries on log files using the
|
|
|
Sqlite3 "virtual" table feature. For all supported log file types,
|
|
|
lnav will create tables that can be queried using the subset of SQL
|
|
|
that is supported by Sqlite3. For example, to get the top ten URLs
|
|
|
being accessed in any loaded Apache log files, you can execute:
|
|
|
|
|
|
▌[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[37m[40mcs_uri_stem[0m[37m[40m, [0m[1m[37m[40mcount[0m[37m[40m([0m[1m[37m[40m*[0m[37m[40m) [0m[1m[36m[40mAS[0m[37m[40m [0m[37m[40mtotal[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40maccess_log[0m[37m[40m [0m
|
|
|
▌[37m[40m [0m[1m[36m[40mGROUP[0m[37m[40m [0m[1m[36m[40mBY[0m[37m[40m [0m[37m[40mcs_uri_stem[0m[37m[40m [0m[1m[36m[40mORDER[0m[37m[40m [0m[1m[36m[40mBY[0m[37m[40m [0m[37m[40mtotal[0m[37m[40m [0m[1m[36m[40mDESC[0m[37m[40m [0m[1m[36m[40mLIMIT[0m[37m[40m [0m[1m[37m[40m10[0m[37m[40m; [0m
|
|
|
|
|
|
The query result view shows the results and graphs any numeric values
|
|
|
found in the result, much like the histogram view.
|
|
|
|
|
|
The builtin set of log tables are listed below. Note that only the log
|
|
|
messages that match a particular format can be queried by a particular
|
|
|
table. You can find the file format and table name for the top log
|
|
|
message by looking in the upper right hand corner of the log file
|
|
|
view.
|
|
|
|
|
|
Some commonly used format tables are:
|
|
|
|
|
|
Name Description
|
|
|
════════════════════════════════════════════════════════════════
|
|
|
access_log Apache common access log format
|
|
|
syslog_log Syslog format
|
|
|
strace_log Strace log format
|
|
|
generic_log 'Generic' log format. This table contains messages
|
|
|
from files that have a very simple format with a
|
|
|
leading timestamp followed by the message.
|
|
|
|
|
|
NOTE: You can get a dump of the schema for the internal tables, and
|
|
|
any attached databases, by running the [37m[40m .schema [0m SQL command.
|
|
|
|
|
|
The columns available for the top log line in the view will
|
|
|
automatically be displayed after pressing the semicolon ([37m[40m ; [0m) key. All
|
|
|
log tables contain at least the following columns:
|
|
|
|
|
|
Column Description
|
|
|
═══════════════════════════════════════════════════════════════════
|
|
|
log_line The line number in the file, starting at zero.
|
|
|
log_part The name of the partition. You can change this
|
|
|
column using an UPDATE SQL statement or with the
|
|
|
'partition-name' command. After a value is set,
|
|
|
the following log messages will have the same
|
|
|
partition name up until another name is set.
|
|
|
log_time The time of the log entry.
|
|
|
log_idle_msecs The amount of time, in milliseconds, between the
|
|
|
current log message and the previous one.
|
|
|
log_level The log level (e.g. info, error, etc...).
|
|
|
log_mark The bookmark status for the line. This column can
|
|
|
be written to using an UPDATE query.
|
|
|
log_path The full path to the file.
|
|
|
log_text The raw line of text. Note that this column is
|
|
|
not included in the result of a 'select *', but it
|
|
|
does exist.
|
|
|
|
|
|
The following tables include the basic columns as listed above and
|
|
|
include a few more columns since the log file format is more
|
|
|
structured.
|
|
|
|
|
|
[33m•[0m [37m[40m syslog_log [0m
|
|
|
|
|
|
Column Description
|
|
|
═════════════════════════════════════════════════════════════════
|
|
|
log_hostname The hostname the message was received from.
|
|
|
log_procname The name of the process that sent the message.
|
|
|
log_pid The process ID of the process that sent the
|
|
|
message.
|
|
|
[33m•[0m [37m[40m access_log [0m (The column names are the same as those
|
|
|
in the Microsoft LogParser tool.)
|
|
|
|
|
|
Column Description
|
|
|
══════════════════════════════════════════════════════════
|
|
|
c_ip The client IP address.
|
|
|
cs_username The client user name.
|
|
|
cs_method The HTTP method.
|
|
|
cs_uri_stem The stem portion of the URI.
|
|
|
cs_uri_query The query portion of the URI.
|
|
|
cs_version The HTTP version string.
|
|
|
sc_status The status number returned to the client.
|
|
|
sc_bytes The number of bytes sent to the client.
|
|
|
cs_referrer The URL of the referring page.
|
|
|
cs_user_agent The user agent string.
|
|
|
[33m•[0m [37m[40m strace_log [0m (Currently, you need to run strace with
|
|
|
the [37m[40m -tt -T [0moptions so there are timestamps for each
|
|
|
function call.)
|
|
|
|
|
|
Column Description
|
|
|
═══════════════════════════════════════════════════════
|
|
|
funcname The name of the syscall.
|
|
|
result The result code.
|
|
|
duration The amount of time spent in the syscall.
|
|
|
arg0 - arg9 The arguments passed to the syscall.
|
|
|
|
|
|
These tables are created dynamically and not stored in memory or on
|
|
|
disk. If you would like to persist some information from the tables,
|
|
|
you can attach another database and create tables in that database.
|
|
|
For example, if you wanted to save the results from the earlier
|
|
|
example of a top ten query into the "/tmp/topten.db" file, you can do:
|
|
|
|
|
|
▌[37m[40m;[0m[1m[36m[40mATTACH[0m[37m[40m [0m[1m[36m[40mDATABASE[0m[37m[40m [0m[35m[40m'/tmp/topten.db'[0m[37m[40m [0m[1m[36m[40mAS[0m[37m[40m [0m[37m[40mtopten[0m[37m[40m; [0m
|
|
|
▌[37m[40m;[0m[1m[36m[40mCREATE[0m[37m[40m [0m[1m[36m[40mTABLE[0m[37m[40m [0m[37m[40mtopten[0m[37m[40m.[0m[37m[40mfoo[0m[37m[40m [0m[1m[36m[40mAS[0m[37m[40m [0m[1m[36m[40mSELECT[0m[37m[40m [0m[37m[40mcs_uri_stem[0m[37m[40m, [0m[1m[37m[40mcount[0m[37m[40m([0m[1m[37m[40m*[0m[37m[40m) [0m[1m[36m[40mAS[0m[37m[40m [0m[37m[40mtotal[0m[37m[40m [0m
|
|
|
▌[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40maccess_log[0m[37m[40m [0m[1m[36m[40mGROUP[0m[37m[40m [0m[1m[36m[40mBY[0m[37m[40m [0m[37m[40mcs_uri_stem[0m[37m[40m [0m[1m[36m[40mORDER[0m[37m[40m [0m[1m[36m[40mBY[0m[37m[40m [0m[37m[40mtotal[0m[37m[40m [0m[1m[36m[40mDESC[0m[37m[40m [0m
|
|
|
▌[37m[40m [0m[1m[36m[40mLIMIT[0m[37m[40m [0m[1m[37m[40m10[0m[37m[40m; [0m
|
|
|
|
|
|
[1mDynamic logline Table (experimental)[0m
|
|
|
|
|
|
(NOTE: This feature is still very new and not completely reliable yet,
|
|
|
use with care.)
|
|
|
|
|
|
For log formats that lack message structure, lnav can parse the log
|
|
|
message and attempt to extract any data fields that it finds. This
|
|
|
feature is available through the [37m[40m logline [0m log table. This table is
|
|
|
dynamically created and defined based on the message at the top of the
|
|
|
log view. For example, given the following log message from "sudo",
|
|
|
lnav will create the "logline" table with columns for "TTY", "PWD",
|
|
|
"USER", and "COMMAND":
|
|
|
|
|
|
▌[37m[40mMay 24 06:48:38 Tim-Stacks-iMac.local sudo[76387]: stack : TTY=ttys003 ; PWD=/Users/stack/github/lbuild ; USER=root ; COMMAND=/bin/echo Hello, World! [0m
|
|
|
|
|
|
Queries executed against this table will then only return results for
|
|
|
other log messages that have the same format. So, if you were to
|
|
|
execute the following query while viewing the above line, you might
|
|
|
get the following results:
|
|
|
|
|
|
▌[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[37m[40mUSER[0m[37m[40m,[0m[37m[40mCOMMAND[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlogline[0m[37m[40m; [0m
|
|
|
|
|
|
USER COMMAND
|
|
|
═════════════════════════════════
|
|
|
root /bin/echo Hello, World!
|
|
|
mal /bin/echo Goodbye, World!
|
|
|
|
|
|
The log parser works by examining each message for key/value pairs
|
|
|
separated by an equal sign (=) or a colon (:). For example, in the
|
|
|
previous example of a "sudo" message, the parser sees the "USER=root"
|
|
|
string as a pair where the key is "USER" and the value is "root". If
|
|
|
no pairs can be found, then anything that looks like a value is
|
|
|
extracted and assigned a numbered column. For example, the following
|
|
|
line is from "dhcpd":
|
|
|
|
|
|
▌[37m[40mSep 16 22:35:57 drill dhcpd: DHCPDISCOVER from 00:16:ce:54:4e:f3 via hme3 [0m
|
|
|
|
|
|
In this case, the lnav parser recognizes that "DHCPDISCOVER", the MAC
|
|
|
address and the "hme3" device name are values and not normal words.
|
|
|
So, it builds a table with three columns for each of these values. The
|
|
|
regular words in the message, like "from" and "via", are then used to
|
|
|
find other messages with a similar format.
|
|
|
|
|
|
If you would like to execute queries against log messages of different
|
|
|
formats at the same time, you can use the 'create-logline-table'
|
|
|
command to permanently create a table using the top line of the log
|
|
|
view as a template.
|
|
|
|
|
|
[1mOther SQL Features[0m
|
|
|
|
|
|
Environment variables can be used in SQL statements by prefixing the
|
|
|
variable name with a dollar-sign ($). For example, to read the value
|
|
|
of the [37m[40m HOME [0m variable, you can do:
|
|
|
|
|
|
▌[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[37m[40m$HOME[0m[37m[40m; [0m
|
|
|
|
|
|
To select the syslog messages that have a hostname field that is equal
|
|
|
to the [37m[40m HOSTNAME [0m variable:
|
|
|
|
|
|
▌[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40msyslog_log[0m[37m[40m [0m[1m[36m[40mWHERE[0m[37m[40m [0m[37m[40mlog_hostname[0m[37m[40m [0m[1m[37m[40m=[0m[37m[40m [0m[37m[40m$HOSTNAME[0m[37m[40m; [0m
|
|
|
|
|
|
NOTE: Variable substitution is done for fields in the query and is not
|
|
|
a plain text substitution. For example, the following statement WILL
|
|
|
NOT WORK:
|
|
|
|
|
|
▌[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40m$TABLE_NAME[0m[37m[40m; [0m[32m[40m-- Syntax error[0m[37m[40m [0m
|
|
|
|
|
|
Access to lnav's environment variables is also available via the
|
|
|
"environ" table. The table has two columns (name, value) and can be
|
|
|
read and written to using SQL SELECT, INSERT, UPDATE, and DELETE
|
|
|
statements. For example, to set the "FOO" variable to the value "BAR":
|
|
|
|
|
|
▌[37m[40m;[0m[1m[36m[40mINSERT[0m[37m[40m [0m[1m[36m[40mINTO[0m[37m[40m [0m[37m[40menviron[0m[37m[40m [0m[1m[36m[40mSELECT[0m[37m[40m [0m[35m[40m'FOO'[0m[37m[40m, [0m[35m[40m'BAR'[0m[37m[40m; [0m
|
|
|
|
|
|
As a more complex example, you can set the variable "LAST" to the last
|
|
|
syslog line number by doing:
|
|
|
|
|
|
▌[37m[40m;[0m[1m[36m[40mINSERT[0m[37m[40m [0m[1m[36m[40mINTO[0m[37m[40m [0m[37m[40menviron[0m[37m[40m [0m[1m[36m[40mSELECT[0m[37m[40m [0m[35m[40m'LAST'[0m[37m[40m, ([0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mmax[0m[37m[40m([0m[37m[40mlog_line[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40msyslog_log[0m[37m[40m); [0m
|
|
|
|
|
|
A delete will unset the environment variable:
|
|
|
|
|
|
▌[37m[40m;[0m[1m[36m[40mDELETE[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40menviron[0m[37m[40m [0m[1m[36m[40mWHERE[0m[37m[40m [0m[37m[40mname[0m[1m[37m[40m=[0m[35m[40m'LAST'[0m[37m[40m; [0m
|
|
|
|
|
|
The table allows you to easily use the results of a SQL query in lnav
|
|
|
commands, which is especially useful when scripting lnav.
|
|
|
|
|
|
[1mContact[0m
|
|
|
|
|
|
For more information, visit the lnav website at:
|
|
|
|
|
|
http://lnav.org
|
|
|
|
|
|
For support questions, email:
|
|
|
|
|
|
[33m•[0m lnav@googlegroups.com
|
|
|
[33m•[0m support@lnav.org
|
|
|
|
|
|
[1mCommand Reference[0m
|
|
|
|
|
|
[4m:[0m[1m[4madjust-log-time[0m[4m [0m[4mtimestamp[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Change the timestamps of the top file to be relative to the given
|
|
|
date
|
|
|
[4mParameter[0m
|
|
|
[4mtimestamp[0m The new timestamp for the top line in the
|
|
|
view
|
|
|
|
|
|
[4mExamples[0m
|
|
|
#1 To set the top timestamp to a given date:
|
|
|
[37m[40m:[0m[1m[36m[40madjust-log-time[0m[37m[40m 2017-01-02T05:33:00 [0m
|
|
|
|
|
|
|
|
|
#2 To set the top timestamp back an hour:
|
|
|
[37m[40m:[0m[1m[36m[40madjust-log-time[0m[37m[40m -1h [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4malt-msg[0m[4m [0m[4mmsg[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Display a message in the alternate command position
|
|
|
[4mParameter[0m
|
|
|
[4mmsg[0m The message to display
|
|
|
[4mSee Also[0m
|
|
|
[1m:cd[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-to[0m, [1m:write-view-to[0m
|
|
|
[4mExample[0m
|
|
|
#1 To display 'Press t to switch to the text view' on the bottom right:
|
|
|
[37m[40m:[0m[1m[36m[40malt-msg[0m[37m[40m Press t to switch to the text view [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mannotate[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Analyze the focused log message and attach annotations
|
|
|
[4mSee Also[0m
|
|
|
[1m:comment[0m, [1m:tag[0m
|
|
|
|
|
|
[4m:[0m[1m[4mappend-to[0m[4m [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Append marked lines in the current view to the given file
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m The path to the file to append to
|
|
|
[4mSee Also[0m
|
|
|
[1m:echo[0m, [1m:export-session-to[0m, [1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:redirect-to[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-to[0m, [1m:write-view-to[0m, [1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To append marked lines to the file /tmp/interesting-lines.txt:
|
|
|
[37m[40m:[0m[1m[36m[40mappend-to[0m[37m[40m /tmp/interesting-lines.txt [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mcd[0m[4m [0m[4mdir[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Change the current directory
|
|
|
[4mParameter[0m
|
|
|
[4mdir[0m The new current directory
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m,
|
|
|
[1m:sh[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-to[0m, [1m:write-view-to[0m
|
|
|
|
|
|
[4m:[0m[1m[4mclear-comment[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Clear the comment attached to the top log line
|
|
|
[4mSee Also[0m
|
|
|
[1m:annotate[0m, [1m:comment[0m, [1m:tag[0m
|
|
|
|
|
|
[4m:[0m[1m[4mclear-file-timezone[0m[4m [0m[4mpattern[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Clear the timezone setting for the focused file or the given glob
|
|
|
pattern.
|
|
|
[4mParameter[0m
|
|
|
[4mpattern[0m The glob pattern to match against files that
|
|
|
should no longer use this timezone
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mclear-filter-expr[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Clear the filter expression
|
|
|
[4mSee Also[0m
|
|
|
[1m:filter-expr[0m, [1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m,
|
|
|
[1m:hide-lines-before[0m, [1m:hide-unmarked-lines[0m, [1m:toggle-filtering[0m
|
|
|
|
|
|
[4m:[0m[1m[4mclear-highlight[0m[4m [0m[4mpattern[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Remove a previously set highlight regular expression
|
|
|
[4mParameter[0m
|
|
|
[4mpattern[0m The regular expression previously used with
|
|
|
:highlight
|
|
|
[4mSee Also[0m
|
|
|
[1m:enable-word-wrap[0m, [1m:hide-fields[0m, [1m:highlight[0m
|
|
|
[4mExample[0m
|
|
|
#1 To clear the highlight with the pattern 'foobar':
|
|
|
[37m[40m:[0m[1m[36m[40mclear-highlight[0m[37m[40m foobar [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mclear-mark-expr[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Clear the mark expression
|
|
|
[4mSee Also[0m
|
|
|
[1m:hide-unmarked-lines[0m, [1m:mark[0m, [1m:mark-expr[0m, [1m:next-mark[0m, [1m:prev-mark[0m
|
|
|
|
|
|
[4m:[0m[1m[4mclear-partition[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Clear the partition the top line is a part of
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mclose[0m[4m [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Close the given file(s) or the top file in the view
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m A path or glob pattern that specifies the files to
|
|
|
close
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mcomment[0m[4m [0m[4mtext[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Attach a comment to the top log line. The comment will be
|
|
|
displayed right below the log message it is associated with. The
|
|
|
comment can be formatted using markdown and you can add new-lines
|
|
|
with '\n'.
|
|
|
[4mParameter[0m
|
|
|
[4mtext[0m The comment text
|
|
|
[4mSee Also[0m
|
|
|
[1m:annotate[0m, [1m:clear-comment[0m, [1m:tag[0m
|
|
|
[4mExample[0m
|
|
|
#1 To add the comment 'This is where it all went wrong' to the top line:
|
|
|
[37m[40m:[0m[1m[36m[40mcomment[0m[37m[40m This is where it all went wrong [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mconfig[0m[4m [0m[4moption[0m[4m [[0m[4mvalue[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Read or write a configuration option
|
|
|
[4mParameters[0m
|
|
|
[4moption[0m The path to the option to read or write
|
|
|
[4mvalue[0m The value to write. If not given, the current
|
|
|
value is returned
|
|
|
[4mSee Also[0m
|
|
|
[1m:reset-config[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To read the configuration of the '/ui/clock-format' option:
|
|
|
[37m[40m:[0m[1m[36m[40mconfig[0m[37m[40m /ui/clock-format [0m
|
|
|
|
|
|
|
|
|
#2 To set the '/ui/dim-text' option to 'false':
|
|
|
[37m[40m:[0m[1m[36m[40mconfig[0m[37m[40m /ui/dim-text false [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mconvert-time-to[0m[4m [0m[4mzone[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Convert the focused timestamp to the given timezone
|
|
|
[4mParameter[0m
|
|
|
[4mzone[0m The timezone name
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mcreate-logline-table[0m[4m [0m[4mtable-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Create an SQL table using the top line of the log view as a
|
|
|
template
|
|
|
[4mParameter[0m
|
|
|
[4mtable-name[0m The name for the new table
|
|
|
[4mSee Also[0m
|
|
|
[1m:create-search-table[0m, [1m:create-search-table[0m, [1m:write-csv-to[0m,
|
|
|
[1m:write-json-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-table-to[0m, [1m:write-view-to[0m
|
|
|
[4mExample[0m
|
|
|
#1 To create a logline-style table named 'task_durations':
|
|
|
[37m[40m:[0m[1m[36m[40mcreate-logline-table[0m[37m[40m task_durations [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mcreate-search-table[0m[4m [0m[4mtable-name[0m[4m [[0m[4mpattern[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Create an SQL table based on a regex search
|
|
|
[4mParameters[0m
|
|
|
[4mtable-name[0m The name of the table to create
|
|
|
[4mpattern[0m The regular expression used to capture
|
|
|
the table columns. If not given, the current search
|
|
|
pattern is used.
|
|
|
[4mSee Also[0m
|
|
|
[1m:create-logline-table[0m, [1m:create-logline-table[0m, [1m:delete-search-table[0m,
|
|
|
[1m:delete-search-table[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-table-to[0m,
|
|
|
[1m:write-view-to[0m
|
|
|
[4mExample[0m
|
|
|
#1 To create a table named 'task_durations' that matches log messages with the pattern
|
|
|
'duration=(?<duration>\d+)':
|
|
|
[37m[40m:[0m[1m[36m[40mcreate-search-table[0m[37m[40m task_durations duration=[0m[1m[32m[40m([0m[1m[32m[40m?[0m[1m[36m[40m<[0m[37m[40mduration>[0m[1m[37m[40m\d[0m[1m[36m[40m+[0m[1m[32m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mcurrent-time[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Print the current time in human-readable form and seconds since
|
|
|
the epoch
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mdelete-filter[0m[4m [0m[4mpattern[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Delete the filter created with [1m:filter-in[0m or [1m:filter-out[0m
|
|
|
[4mParameter[0m
|
|
|
[4mpattern[0m The regular expression to match
|
|
|
[4mSee Also[0m
|
|
|
[1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m, [1m:hide-lines-before[0m,
|
|
|
[1m:hide-unmarked-lines[0m, [1m:toggle-filtering[0m
|
|
|
[4mExample[0m
|
|
|
#1 To delete the filter with the pattern 'last message repeated':
|
|
|
[37m[40m:[0m[1m[36m[40mdelete-filter[0m[37m[40m last message repeated [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mdelete-logline-table[0m[4m [0m[4mtable-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Delete a table created with create-logline-table
|
|
|
[4mParameter[0m
|
|
|
[4mtable-name[0m The name of the table to delete
|
|
|
[4mSee Also[0m
|
|
|
[1m:create-logline-table[0m, [1m:create-logline-table[0m, [1m:create-search-table[0m,
|
|
|
[1m:create-search-table[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-table-to[0m,
|
|
|
[1m:write-view-to[0m
|
|
|
[4mExample[0m
|
|
|
#1 To delete the logline-style table named 'task_durations':
|
|
|
[37m[40m:[0m[1m[36m[40mdelete-logline-table[0m[37m[40m task_durations [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mdelete-search-table[0m[4m [0m[4mtable-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Create an SQL table based on a regex search
|
|
|
[4mParameter[0m
|
|
|
[4mtable-name[0m The name of the table to create
|
|
|
[4mSee Also[0m
|
|
|
[1m:create-logline-table[0m, [1m:create-logline-table[0m, [1m:create-search-table[0m,
|
|
|
[1m:create-search-table[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-table-to[0m,
|
|
|
[1m:write-view-to[0m
|
|
|
[4mExample[0m
|
|
|
#1 To delete the search table named 'task_durations':
|
|
|
[37m[40m:[0m[1m[36m[40mdelete-search-table[0m[37m[40m task_durations [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mdelete-tags[0m[4m [0m[4mtag[0m[4m1[0m[4m [[0m[4m...[0m[4m [0m[4mtag[0m[4mN[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Remove the given tags from all log lines
|
|
|
[4mParameter[0m
|
|
|
[4mtag[0m The tags to delete
|
|
|
[4mSee Also[0m
|
|
|
[1m:annotate[0m, [1m:comment[0m, [1m:tag[0m
|
|
|
[4mExample[0m
|
|
|
#1 To remove the tags '#BUG123' and '#needs-review' from all log lines:
|
|
|
[37m[40m:[0m[1m[36m[40mdelete-tags[0m[37m[40m [0m[37m[40m#BUG123[0m[37m[40m [0m[37m[40m#needs-review[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mdisable-filter[0m[4m [0m[4mpattern[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Disable a filter created with filter-in/filter-out
|
|
|
[4mParameter[0m
|
|
|
[4mpattern[0m The regular expression used in the filter
|
|
|
command
|
|
|
[4mSee Also[0m
|
|
|
[1m:enable-filter[0m, [1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m,
|
|
|
[1m:hide-lines-before[0m, [1m:hide-unmarked-lines[0m, [1m:toggle-filtering[0m
|
|
|
[4mExample[0m
|
|
|
#1 To disable the filter with the pattern 'last message repeated':
|
|
|
[37m[40m:[0m[1m[36m[40mdisable-filter[0m[37m[40m last message repeated [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mdisable-word-wrap[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Disable word-wrapping for the current view
|
|
|
[4mSee Also[0m
|
|
|
[1m:enable-word-wrap[0m, [1m:hide-fields[0m, [1m:highlight[0m
|
|
|
|
|
|
[4m:[0m[1m[4mecho[0m[4m [[0m[4m-n[0m[4m] [0m[4mmsg[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Echo the given message to the screen or, if :redirect-to has been
|
|
|
called, to output file specified in the redirect. Variable
|
|
|
substitution is performed on the message. Use a backslash to escape
|
|
|
any special characters, like '$'
|
|
|
[4mParameters[0m
|
|
|
[4m-n[0m Do not print a line-feed at the end of the output
|
|
|
[4mmsg[0m The message to display
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:eval[0m, [1m:export-session-to[0m,
|
|
|
[1m:export-session-to[0m, [1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m,
|
|
|
[1m:redirect-to[0m, [1m:sh[0m, [1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-json-to[0m, [1m:write-jsonlines-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-to[0m, [1m:write-to[0m, [1m:write-view-to[0m,
|
|
|
[1m:write-view-to[0m, [1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To output 'Hello, World!':
|
|
|
[37m[40m:[0m[1m[36m[40mecho[0m[37m[40m Hello, World! [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4menable-filter[0m[4m [0m[4mpattern[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Enable a previously created and disabled filter
|
|
|
[4mParameter[0m
|
|
|
[4mpattern[0m The regular expression used in the filter
|
|
|
command
|
|
|
[4mSee Also[0m
|
|
|
[1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m, [1m:hide-lines-before[0m,
|
|
|
[1m:hide-unmarked-lines[0m, [1m:toggle-filtering[0m
|
|
|
[4mExample[0m
|
|
|
#1 To enable the disabled filter with the pattern 'last message repeated':
|
|
|
[37m[40m:[0m[1m[36m[40menable-filter[0m[37m[40m last message repeated [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4menable-word-wrap[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Enable word-wrapping for the current view
|
|
|
[4mSee Also[0m
|
|
|
[1m:disable-word-wrap[0m, [1m:hide-fields[0m, [1m:highlight[0m
|
|
|
|
|
|
[4m:[0m[1m[4meval[0m[4m [0m[4mcommand[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Evaluate the given command/query after doing environment variable
|
|
|
substitution
|
|
|
[4mParameter[0m
|
|
|
[4mcommand[0m The command or query to perform substitution
|
|
|
on.
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:cd[0m, [1m:echo[0m, [1m:export-session-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-to[0m, [1m:write-view-to[0m
|
|
|
[4mExample[0m
|
|
|
#1 To substitute the table name from a variable:
|
|
|
[37m[40m:[0m[1m[36m[40meval[0m[37m[40m ;SELECT * FROM [0m[1m[37m[40m${[0m[37m[40mtable[0m[1m[37m[40m}[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mexport-session-to[0m[4m [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Export the current lnav state to an executable lnav script file
|
|
|
that contains the commands needed to restore the current session
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m The path to the file to write
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:pipe-line-to[0m,
|
|
|
[1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:redirect-to[0m, [1m:sh[0m, [1m:write-csv-to[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-raw-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-to[0m,
|
|
|
[1m:write-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1mecholn()[0m
|
|
|
|
|
|
[4m:[0m[1m[4mfilter-expr[0m[4m [0m[4mexpr[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Set the filter expression
|
|
|
[4mParameter[0m
|
|
|
[4mexpr[0m The SQL expression to evaluate for each log message.
|
|
|
The message values can be accessed using column names
|
|
|
prefixed with a colon
|
|
|
[4mSee Also[0m
|
|
|
[1m:clear-filter-expr[0m, [1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m,
|
|
|
[1m:hide-lines-before[0m, [1m:hide-unmarked-lines[0m, [1m:toggle-filtering[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To set a filter expression that matched syslog messages from 'syslogd':
|
|
|
[37m[40m:[0m[1m[36m[40mfilter-expr[0m[37m[40m [0m[37m[40m:log_procname[0m[37m[40m [0m[1m[37m[40m=[0m[37m[40m [0m[35m[40m'syslogd'[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
#2 To set a filter expression that matches log messages where 'id' is followed by a
|
|
|
number and contains the string 'foo':
|
|
|
[37m[40m:[0m[1m[36m[40mfilter-expr[0m[37m[40m [0m[37m[40m:log_body[0m[37m[40m [0m[1m[36m[40mREGEXP[0m[37m[40m [0m[35m[40m'id\d+'[0m[37m[40m [0m[1m[36m[40mAND[0m[37m[40m [0m[37m[40m:log_body[0m[37m[40m [0m[1m[36m[40mREGEXP[0m[37m[40m [0m[35m[40m'foo'[0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mfilter-in[0m[4m [0m[4mpattern[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Only show lines that match the given regular expression in the
|
|
|
current view
|
|
|
[4mParameter[0m
|
|
|
[4mpattern[0m The regular expression to match
|
|
|
[4mSee Also[0m
|
|
|
[1m:delete-filter[0m, [1m:disable-filter[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m,
|
|
|
[1m:hide-lines-before[0m, [1m:hide-unmarked-lines[0m, [1m:toggle-filtering[0m
|
|
|
[4mExample[0m
|
|
|
#1 To filter out log messages that do not have the string 'dhclient':
|
|
|
[37m[40m:[0m[1m[36m[40mfilter-in[0m[37m[40m dhclient [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mfilter-out[0m[4m [0m[4mpattern[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Remove lines that match the given regular expression in the
|
|
|
current view
|
|
|
[4mParameter[0m
|
|
|
[4mpattern[0m The regular expression to match
|
|
|
[4mSee Also[0m
|
|
|
[1m:delete-filter[0m, [1m:disable-filter[0m, [1m:filter-in[0m, [1m:hide-lines-after[0m,
|
|
|
[1m:hide-lines-before[0m, [1m:hide-unmarked-lines[0m, [1m:toggle-filtering[0m
|
|
|
[4mExample[0m
|
|
|
#1 To filter out log messages that contain the string 'last message repeated':
|
|
|
[37m[40m:[0m[1m[36m[40mfilter-out[0m[37m[40m last message repeated [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mgoto[0m[4m [0m[4mline#|N%|timestamp|#anchor[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Go to the given location in the top view
|
|
|
[4mParameter[0m
|
|
|
[4mline#|N%|timestamp|#anchor[0m A line
|
|
|
number, percent into the file,
|
|
|
timestamp, or an anchor in a text file
|
|
|
[4mSee Also[0m
|
|
|
[1m:next-location[0m, [1m:next-mark[0m, [1m:prev-location[0m, [1m:prev-mark[0m, [1m:relative-goto[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To go to line 22:
|
|
|
[37m[40m:[0m[1m[36m[40mgoto[0m[37m[40m 22 [0m
|
|
|
|
|
|
|
|
|
#2 To go to the line 75% of the way into the view:
|
|
|
[37m[40m:[0m[1m[36m[40mgoto[0m[37m[40m 75% [0m
|
|
|
|
|
|
|
|
|
#3 To go to the first message on the first day of 2017:
|
|
|
[37m[40m:[0m[1m[36m[40mgoto[0m[37m[40m 2017-01-01 [0m
|
|
|
|
|
|
|
|
|
#4 To go to the Screenshots section:
|
|
|
[37m[40m:[0m[1m[36m[40mgoto[0m[37m[40m #screenshots [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mhelp[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Open the help text view
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mhide-fields[0m[4m [0m[4mfield-name[0m[4m1[0m[4m [[0m[4m...[0m[4m [0m[4mfield-name[0m[4mN[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Hide log message fields by replacing them with an ellipsis
|
|
|
[4mParameter[0m
|
|
|
[4mfield-name[0m The name of the field to hide in the
|
|
|
format for the top log line. A qualified name can be
|
|
|
used where the field name is prefixed by the format
|
|
|
name and a dot to hide any field.
|
|
|
[4mSee Also[0m
|
|
|
[1m:enable-word-wrap[0m, [1m:highlight[0m, [1m:show-fields[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To hide the log_procname fields in all formats:
|
|
|
[37m[40m:[0m[1m[36m[40mhide-fields[0m[37m[40m log_procname [0m
|
|
|
|
|
|
|
|
|
#2 To hide only the log_procname field in the syslog format:
|
|
|
[37m[40m:[0m[1m[36m[40mhide-fields[0m[37m[40m syslog_log.log_procname [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mhide-file[0m[4m [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Hide the given file(s) and skip indexing until it is shown again.
|
|
|
If no path is given, the current file in the view is hidden
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m A path or glob pattern that specifies the files to
|
|
|
hide
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mhide-lines-after[0m[4m [0m[4mdate[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Hide lines that come after the given date
|
|
|
[4mParameter[0m
|
|
|
[4mdate[0m An absolute or relative date
|
|
|
[4mSee Also[0m
|
|
|
[1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-before[0m, [1m:hide-unmarked-lines[0m,
|
|
|
[1m:show-lines-before-and-after[0m, [1m:toggle-filtering[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To hide the lines after the top line in the view:
|
|
|
[37m[40m:[0m[1m[36m[40mhide-lines-after[0m[37m[40m here [0m
|
|
|
|
|
|
|
|
|
#2 To hide the lines after 6 AM today:
|
|
|
[37m[40m:[0m[1m[36m[40mhide-lines-after[0m[37m[40m 6am [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mhide-lines-before[0m[4m [0m[4mdate[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Hide lines that come before the given date
|
|
|
[4mParameter[0m
|
|
|
[4mdate[0m An absolute or relative date
|
|
|
[4mSee Also[0m
|
|
|
[1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m, [1m:hide-unmarked-lines[0m,
|
|
|
[1m:show-lines-before-and-after[0m, [1m:toggle-filtering[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To hide the lines before the top line in the view:
|
|
|
[37m[40m:[0m[1m[36m[40mhide-lines-before[0m[37m[40m here [0m
|
|
|
|
|
|
|
|
|
#2 To hide the log messages before 6 AM today:
|
|
|
[37m[40m:[0m[1m[36m[40mhide-lines-before[0m[37m[40m 6am [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mhide-unmarked-lines[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Hide lines that have not been bookmarked
|
|
|
[4mSee Also[0m
|
|
|
[1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m, [1m:hide-lines-before[0m, [1m:mark[0m,
|
|
|
[1m:next-mark[0m, [1m:prev-mark[0m, [1m:toggle-filtering[0m
|
|
|
|
|
|
[4m:[0m[1m[4mhighlight[0m[4m [0m[4mpattern[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Add coloring to log messages fragments that match the given
|
|
|
regular expression
|
|
|
[4mParameter[0m
|
|
|
[4mpattern[0m The regular expression to match
|
|
|
[4mSee Also[0m
|
|
|
[1m:clear-highlight[0m, [1m:enable-word-wrap[0m, [1m:hide-fields[0m
|
|
|
[4mExample[0m
|
|
|
#1 To highlight numbers with three or more digits:
|
|
|
[37m[40m:[0m[1m[36m[40mhighlight[0m[37m[40m [0m[1m[37m[40m\d[0m[1m[32m[40m{[0m[37m[40m3,[0m[1m[32m[40m}[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mload-session[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Load the latest session state
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mmark[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Toggle the bookmark state for the top line in the current view
|
|
|
[4mSee Also[0m
|
|
|
[1m:hide-unmarked-lines[0m, [1m:next-mark[0m, [1m:prev-mark[0m
|
|
|
|
|
|
[4m:[0m[1m[4mmark-expr[0m[4m [0m[4mexpr[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Set the bookmark expression
|
|
|
[4mParameter[0m
|
|
|
[4mexpr[0m The SQL expression to evaluate for each log message.
|
|
|
The message values can be accessed using column names
|
|
|
prefixed with a colon
|
|
|
[4mSee Also[0m
|
|
|
[1m:clear-mark-expr[0m, [1m:hide-unmarked-lines[0m, [1m:mark[0m, [1m:next-mark[0m, [1m:prev-mark[0m
|
|
|
[4mExample[0m
|
|
|
#1 To mark lines from 'dhclient' that mention 'eth0':
|
|
|
[37m[40m:[0m[1m[36m[40mmark-expr[0m[37m[40m [0m[37m[40m:log_procname[0m[37m[40m [0m[1m[37m[40m=[0m[37m[40m [0m[35m[40m'dhclient'[0m[37m[40m [0m[1m[36m[40mAND[0m[37m[40m [0m[37m[40m:log_body[0m[37m[40m [0m[1m[36m[40mLIKE[0m[37m[40m [0m[35m[40m'%eth0%'[0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mnext-location[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Move to the next position in the location history
|
|
|
[4mSee Also[0m
|
|
|
[1m:goto[0m, [1m:next-mark[0m, [1m:prev-location[0m, [1m:prev-mark[0m, [1m:relative-goto[0m
|
|
|
|
|
|
[4m:[0m[1m[4mnext-mark[0m[4m [0m[4mtype[0m[4m1[0m[4m [[0m[4m...[0m[4m [0m[4mtype[0m[4mN[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Move to the next bookmark of the given type in the current view
|
|
|
[4mParameter[0m
|
|
|
[4mtype[0m The type of bookmark -- error, warning, search,
|
|
|
user, file, meta
|
|
|
[4mSee Also[0m
|
|
|
[1m:goto[0m, [1m:hide-unmarked-lines[0m, [1m:mark[0m, [1m:next-location[0m, [1m:prev-location[0m,
|
|
|
[1m:prev-mark[0m, [1m:prev-mark[0m, [1m:relative-goto[0m
|
|
|
[4mExample[0m
|
|
|
#1 To go to the next error:
|
|
|
[37m[40m:[0m[1m[36m[40mnext-mark[0m[37m[40m error [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mopen[0m[4m [0m[4mpath[0m[4m1[0m[4m [[0m[4m...[0m[4m [0m[4mpath[0m[4mN[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Open the given file(s) in lnav. Opening files on machines
|
|
|
accessible via SSH can be done using the syntax:
|
|
|
[user@]host:/path/to/logs
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m The path to the file to open
|
|
|
|
|
|
[4mExamples[0m
|
|
|
#1 To open the file '/path/to/file':
|
|
|
[37m[40m:[0m[1m[36m[40mopen[0m[37m[40m /path/to/file [0m
|
|
|
|
|
|
|
|
|
#2 To open the remote file '/var/log/syslog.log':
|
|
|
[37m[40m:[0m[1m[36m[40mopen[0m[37m[40m dean@host1.example.com:/var/log/syslog.log [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mpartition-name[0m[4m [0m[4mname[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Mark the top line in the log view as the start of a new partition
|
|
|
with the given name
|
|
|
[4mParameter[0m
|
|
|
[4mname[0m The name for the new partition
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To mark the top line as the start of the partition named 'boot #1':
|
|
|
[37m[40m:[0m[1m[36m[40mpartition-name[0m[37m[40m boot #1 [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mpipe-line-to[0m[4m [0m[4mshell-cmd[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Pipe the focused line to the given shell command. Any fields
|
|
|
defined by the format will be set as environment variables.
|
|
|
[4mParameter[0m
|
|
|
[4mshell-cmd[0m The shell command-line to execute
|
|
|
[4mSee Also[0m
|
|
|
[1m:append-to[0m, [1m:echo[0m, [1m:export-session-to[0m, [1m:pipe-to[0m, [1m:redirect-to[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-to[0m, [1m:write-view-to[0m, [1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write the top line to 'sed' for processing:
|
|
|
[37m[40m:[0m[1m[36m[40mpipe-line-to[0m[37m[40m sed -e 's/foo/bar/g' [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mpipe-to[0m[4m [0m[4mshell-cmd[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Pipe the marked lines to the given shell command
|
|
|
[4mParameter[0m
|
|
|
[4mshell-cmd[0m The shell command-line to execute
|
|
|
[4mSee Also[0m
|
|
|
[1m:append-to[0m, [1m:echo[0m, [1m:export-session-to[0m, [1m:pipe-line-to[0m, [1m:redirect-to[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-to[0m, [1m:write-view-to[0m, [1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write marked lines to 'sed' for processing:
|
|
|
[37m[40m:[0m[1m[36m[40mpipe-to[0m[37m[40m sed -e s/foo/bar/g [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mprev-location[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Move to the previous position in the location history
|
|
|
[4mSee Also[0m
|
|
|
[1m:goto[0m, [1m:next-location[0m, [1m:next-mark[0m, [1m:prev-mark[0m, [1m:relative-goto[0m
|
|
|
|
|
|
[4m:[0m[1m[4mprev-mark[0m[4m [0m[4mtype[0m[4m1[0m[4m [[0m[4m...[0m[4m [0m[4mtype[0m[4mN[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Move to the previous bookmark of the given type in the current
|
|
|
view
|
|
|
[4mParameter[0m
|
|
|
[4mtype[0m The type of bookmark -- error, warning, search,
|
|
|
user, file, meta
|
|
|
[4mSee Also[0m
|
|
|
[1m:goto[0m, [1m:hide-unmarked-lines[0m, [1m:mark[0m, [1m:next-location[0m, [1m:next-mark[0m,
|
|
|
[1m:next-mark[0m, [1m:prev-location[0m, [1m:relative-goto[0m
|
|
|
[4mExample[0m
|
|
|
#1 To go to the previous error:
|
|
|
[37m[40m:[0m[1m[36m[40mprev-mark[0m[37m[40m error [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mprompt[0m[4m [0m[4mtype[0m[4m [[0m[4m--alt[0m[4m] [[0m[4mprompt[0m[4m] [[0m[4minitial-value[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Open the given prompt
|
|
|
[4mParameters[0m
|
|
|
[4mtype[0m The type of prompt -- command,
|
|
|
script, search, sql, user
|
|
|
[4m--alt[0m Perform the alternate action for
|
|
|
this prompt by default
|
|
|
[4mprompt[0m The prompt to display
|
|
|
[4minitial-value[0m The initial value to fill in for
|
|
|
the prompt
|
|
|
|
|
|
[4mExamples[0m
|
|
|
#1 To open the command prompt with 'filter-in' already filled in:
|
|
|
[37m[40m:[0m[1m[36m[40mprompt[0m[37m[40m command : 'filter-in ' [0m
|
|
|
|
|
|
|
|
|
#2 To ask the user a question:
|
|
|
[37m[40m:[0m[1m[36m[40mprompt[0m[37m[40m user 'Are you sure? ' [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mquit[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Quit lnav
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mquit[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Quit lnav
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mquit[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Quit lnav
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mrebuild[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Forcefully rebuild file indexes
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:cd[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-to[0m, [1m:write-view-to[0m
|
|
|
|
|
|
[4m:[0m[1m[4mredirect-to[0m[4m [[0m[4mpath[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Redirect the output of commands that write to stdout to the given
|
|
|
file
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m The path to the file to write. If not specified,
|
|
|
the current redirect will be cleared
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m,
|
|
|
[1m:export-session-to[0m, [1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-screen-to[0m, [1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-table-to[0m,
|
|
|
[1m:write-to[0m, [1m:write-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write the output of lnav commands to the file /tmp/script-output.txt:
|
|
|
[37m[40m:[0m[1m[36m[40mredirect-to[0m[37m[40m /tmp/script-output.txt [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mredraw[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Do a full redraw of the screen
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mrelative-goto[0m[4m [0m[4mline-count|N%[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Move the current view up or down by the given amount
|
|
|
[4mParameter[0m
|
|
|
[4mline-count|N%[0m The amount to move the view by.
|
|
|
[4mSee Also[0m
|
|
|
[1m:goto[0m, [1m:next-location[0m, [1m:next-mark[0m, [1m:prev-location[0m, [1m:prev-mark[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To move 22 lines down in the view:
|
|
|
[37m[40m:[0m[1m[36m[40mrelative-goto[0m[37m[40m +22 [0m
|
|
|
|
|
|
|
|
|
#2 To move 10 percent back in the view:
|
|
|
[37m[40m:[0m[1m[36m[40mrelative-goto[0m[37m[40m -10% [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mreset-config[0m[4m [0m[4moption[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Reset the configuration option to its default value
|
|
|
[4mParameter[0m
|
|
|
[4moption[0m The path to the option to reset
|
|
|
[4mSee Also[0m
|
|
|
[1m:config[0m
|
|
|
[4mExample[0m
|
|
|
#1 To reset the '/ui/clock-format' option back to the builtin default:
|
|
|
[37m[40m:[0m[1m[36m[40mreset-config[0m[37m[40m /ui/clock-format [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mreset-session[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Reset the session state, clearing all filters, highlights, and
|
|
|
bookmarks
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4msave-session[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Save the current state as a session
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4msession[0m[4m [0m[4mlnav-command[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Add the given command to the session file (~/.lnav/session)
|
|
|
[4mParameter[0m
|
|
|
[4mlnav-command[0m The lnav command to save.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To add the command ':highlight foobar' to the session file:
|
|
|
[37m[40m:[0m[1m[36m[40msession[0m[37m[40m :highlight foobar [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mset-file-timezone[0m[4m [0m[4mzone[0m[4m [[0m[4mpattern[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Set the timezone to use for log messages that do not include a
|
|
|
timezone. The timezone is applied to the focused file or the given
|
|
|
glob pattern.
|
|
|
[4mParameters[0m
|
|
|
[4mzone[0m The timezone name
|
|
|
[4mpattern[0m The glob pattern to match against files that
|
|
|
should use this timezone
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mset-min-log-level[0m[4m [0m[4mlog-level[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Set the minimum log level to display in the log view
|
|
|
[4mParameter[0m
|
|
|
[4mlog-level[0m The new minimum log level
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To set the minimum log level displayed to error:
|
|
|
[37m[40m:[0m[1m[36m[40mset-min-log-level[0m[37m[40m error [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4msh[0m[4m [0m[4m--name=<name>[0m[4m [0m[4mcmdline[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Execute the given command-line and display the captured output
|
|
|
[4mParameters[0m
|
|
|
[4m--name=<name>[0m The name to give to the captured
|
|
|
output
|
|
|
[4mcmdline[0m The command-line to execute.
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:cd[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:rebuild[0m,
|
|
|
[1m:redirect-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-to[0m,
|
|
|
[1m:write-view-to[0m
|
|
|
|
|
|
[4m:[0m[1m[4mshow-fields[0m[4m [0m[4mfield-name[0m[4m1[0m[4m [[0m[4m...[0m[4m [0m[4mfield-name[0m[4mN[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Show log message fields that were previously hidden
|
|
|
[4mParameter[0m
|
|
|
[4mfield-name[0m The name of the field to show
|
|
|
[4mSee Also[0m
|
|
|
[1m:enable-word-wrap[0m, [1m:hide-fields[0m, [1m:highlight[0m
|
|
|
[4mExample[0m
|
|
|
#1 To show all the log_procname fields in all formats:
|
|
|
[37m[40m:[0m[1m[36m[40mshow-fields[0m[37m[40m log_procname [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mshow-file[0m[4m [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Show the given file(s) and resume indexing.
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m The path or glob pattern that specifies the files to
|
|
|
show
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mshow-lines-before-and-after[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Show lines that were hidden by the 'hide-lines' commands
|
|
|
[4mSee Also[0m
|
|
|
[1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m, [1m:hide-lines-before[0m,
|
|
|
[1m:hide-unmarked-lines[0m, [1m:toggle-filtering[0m
|
|
|
|
|
|
[4m:[0m[1m[4mshow-only-this-file[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Show only the file for the top line in the view
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mshow-unmarked-lines[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Show lines that have not been bookmarked
|
|
|
[4mSee Also[0m
|
|
|
[1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m, [1m:hide-lines-before[0m,
|
|
|
[1m:hide-unmarked-lines[0m, [1m:hide-unmarked-lines[0m, [1m:mark[0m, [1m:next-mark[0m,
|
|
|
[1m:prev-mark[0m, [1m:toggle-filtering[0m
|
|
|
|
|
|
[4m:[0m[1m[4mspectrogram[0m[4m [0m[4mfield-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Visualize the given message field or database column using a
|
|
|
spectrogram
|
|
|
[4mParameter[0m
|
|
|
[4mfield-name[0m The name of the numeric field to
|
|
|
visualize.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To visualize the sc_bytes field in the access_log format:
|
|
|
[37m[40m:[0m[1m[36m[40mspectrogram[0m[37m[40m sc_bytes [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4msummarize[0m[4m [0m[4mcolumn-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Execute a SQL query that computes the characteristics of the
|
|
|
values in the given column
|
|
|
[4mParameter[0m
|
|
|
[4mcolumn-name[0m The name of the column to analyze.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To get a summary of the sc_bytes column in the access_log table:
|
|
|
[37m[40m:[0m[1m[36m[40msummarize[0m[37m[40m sc_bytes [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mswitch-to-view[0m[4m [0m[4mview-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Switch to the given view
|
|
|
[4mParameter[0m
|
|
|
[4mview-name[0m The name of the view to switch to.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To switch to the 'schema' view:
|
|
|
[37m[40m:[0m[1m[36m[40mswitch-to-view[0m[37m[40m schema [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mtag[0m[4m [0m[4mtag[0m[4m1[0m[4m [[0m[4m...[0m[4m [0m[4mtag[0m[4mN[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Attach tags to the top log line
|
|
|
[4mParameter[0m
|
|
|
[4mtag[0m The tags to attach
|
|
|
[4mSee Also[0m
|
|
|
[1m:annotate[0m, [1m:comment[0m, [1m:delete-tags[0m, [1m:untag[0m
|
|
|
[4mExample[0m
|
|
|
#1 To add the tags '#BUG123' and '#needs-review' to the top line:
|
|
|
[37m[40m:[0m[1m[36m[40mtag[0m[37m[40m [0m[37m[40m#BUG123[0m[37m[40m [0m[37m[40m#needs-review[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mtoggle-filtering[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Toggle the filtering flag for the current view
|
|
|
[4mSee Also[0m
|
|
|
[1m:filter-in[0m, [1m:filter-out[0m, [1m:hide-lines-after[0m, [1m:hide-lines-before[0m,
|
|
|
[1m:hide-unmarked-lines[0m
|
|
|
|
|
|
[4m:[0m[1m[4mtoggle-view[0m[4m [0m[4mview-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Switch to the given view or, if it is already displayed, switch to
|
|
|
the previous view
|
|
|
[4mParameter[0m
|
|
|
[4mview-name[0m The name of the view to toggle the display
|
|
|
of.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To switch to the 'schema' view if it is not displayed or switch back to the previous
|
|
|
view:
|
|
|
[37m[40m:[0m[1m[36m[40mtoggle-view[0m[37m[40m schema [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4munix-time[0m[4m [0m[4mseconds[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Convert epoch time to a human-readable form
|
|
|
[4mParameter[0m
|
|
|
[4mseconds[0m The epoch timestamp to convert
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To convert the epoch time 1490191111:
|
|
|
[37m[40m:[0m[1m[36m[40munix-time[0m[37m[40m 1490191111 [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4muntag[0m[4m [0m[4mtag[0m[4m1[0m[4m [[0m[4m...[0m[4m [0m[4mtag[0m[4mN[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Detach tags from the top log line
|
|
|
[4mParameter[0m
|
|
|
[4mtag[0m The tags to detach
|
|
|
[4mSee Also[0m
|
|
|
[1m:annotate[0m, [1m:comment[0m, [1m:tag[0m
|
|
|
[4mExample[0m
|
|
|
#1 To remove the tags '#BUG123' and '#needs-review' from the top line:
|
|
|
[37m[40m:[0m[1m[36m[40muntag[0m[37m[40m [0m[37m[40m#BUG123[0m[37m[40m [0m[37m[40m#needs-review[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mwrite-table-to[0m[4m [[0m[4m--anonymize[0m[4m] [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Write SQL results to the given file in a tabular format
|
|
|
[4mParameters[0m
|
|
|
[4m--anonymize[0m Anonymize the table contents
|
|
|
[4mpath[0m The path to the file to write
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:create-logline-table[0m, [1m:create-search-table[0m,
|
|
|
[1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:export-session-to[0m,
|
|
|
[1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-json-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-to[0m, [1m:write-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m,
|
|
|
[1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write SQL results as text to /tmp/table.txt:
|
|
|
[37m[40m:[0m[1m[36m[40mwrite-table-to[0m[37m[40m /tmp/table.txt [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mwrite-csv-to[0m[4m [[0m[4m--anonymize[0m[4m] [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Write SQL results to the given file in CSV format
|
|
|
[4mParameters[0m
|
|
|
[4m--anonymize[0m Anonymize the row contents
|
|
|
[4mpath[0m The path to the file to write
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:create-logline-table[0m, [1m:create-search-table[0m,
|
|
|
[1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:export-session-to[0m,
|
|
|
[1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-json-to[0m, [1m:write-json-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-to[0m,
|
|
|
[1m:write-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write SQL results as CSV to /tmp/table.csv:
|
|
|
[37m[40m:[0m[1m[36m[40mwrite-csv-to[0m[37m[40m /tmp/table.csv [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mwrite-json-to[0m[4m [[0m[4m--anonymize[0m[4m] [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Write SQL results to the given file in JSON format
|
|
|
[4mParameters[0m
|
|
|
[4m--anonymize[0m Anonymize the JSON values
|
|
|
[4mpath[0m The path to the file to write
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:create-logline-table[0m, [1m:create-search-table[0m,
|
|
|
[1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:export-session-to[0m,
|
|
|
[1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-to[0m,
|
|
|
[1m:write-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write SQL results as JSON to /tmp/table.json:
|
|
|
[37m[40m:[0m[1m[36m[40mwrite-json-to[0m[37m[40m /tmp/table.json [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mwrite-jsonlines-to[0m[4m [[0m[4m--anonymize[0m[4m] [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Write SQL results to the given file in JSON Lines format
|
|
|
[4mParameters[0m
|
|
|
[4m--anonymize[0m Anonymize the JSON values
|
|
|
[4mpath[0m The path to the file to write
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:create-logline-table[0m, [1m:create-search-table[0m,
|
|
|
[1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:export-session-to[0m,
|
|
|
[1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-json-to[0m, [1m:write-json-to[0m, [1m:write-raw-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-to[0m,
|
|
|
[1m:write-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write SQL results as JSON Lines to /tmp/table.json:
|
|
|
[37m[40m:[0m[1m[36m[40mwrite-jsonlines-to[0m[37m[40m /tmp/table.json [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mwrite-raw-to[0m[4m [[0m[4m--view={log,db}[0m[4m] [[0m[4m--anonymize[0m[4m] [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
In the log view, write the original log file content of the marked
|
|
|
messages to the file. In the DB view, the contents of the cells are
|
|
|
written to the output file.
|
|
|
[4mParameters[0m
|
|
|
[4m--view={log,db}[0m The view to use as the source
|
|
|
of data
|
|
|
[4m--anonymize[0m Anonymize the lines
|
|
|
[4mpath[0m The path to the file to write
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:create-logline-table[0m, [1m:create-search-table[0m,
|
|
|
[1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:export-session-to[0m,
|
|
|
[1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-json-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-jsonlines-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-screen-to[0m, [1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-table-to[0m,
|
|
|
[1m:write-table-to[0m, [1m:write-to[0m, [1m:write-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m,
|
|
|
[1m:write-view-to[0m, [1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write the marked lines in the log view to /tmp/table.txt:
|
|
|
[37m[40m:[0m[1m[36m[40mwrite-raw-to[0m[37m[40m /tmp/table.txt [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mwrite-screen-to[0m[4m [[0m[4m--anonymize[0m[4m] [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Write the displayed text or SQL results to the given file without
|
|
|
any formatting
|
|
|
[4mParameters[0m
|
|
|
[4m--anonymize[0m Anonymize the lines
|
|
|
[4mpath[0m The path to the file to write
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:create-logline-table[0m, [1m:create-search-table[0m,
|
|
|
[1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:export-session-to[0m,
|
|
|
[1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-json-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-table-to[0m,
|
|
|
[1m:write-to[0m, [1m:write-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m,
|
|
|
[1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write only the displayed text to /tmp/table.txt:
|
|
|
[37m[40m:[0m[1m[36m[40mwrite-screen-to[0m[37m[40m /tmp/table.txt [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mwrite-table-to[0m[4m [[0m[4m--anonymize[0m[4m] [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Write SQL results to the given file in a tabular format
|
|
|
[4mParameters[0m
|
|
|
[4m--anonymize[0m Anonymize the table contents
|
|
|
[4mpath[0m The path to the file to write
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:create-logline-table[0m, [1m:create-search-table[0m,
|
|
|
[1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:export-session-to[0m,
|
|
|
[1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-json-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-to[0m, [1m:write-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m,
|
|
|
[1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write SQL results as text to /tmp/table.txt:
|
|
|
[37m[40m:[0m[1m[36m[40mwrite-table-to[0m[37m[40m /tmp/table.txt [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mwrite-to[0m[4m [[0m[4m--anonymize[0m[4m] [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Overwrite the given file with any marked lines in the current view
|
|
|
[4mParameters[0m
|
|
|
[4m--anonymize[0m Anonymize the lines
|
|
|
[4mpath[0m The path to the file to write
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m,
|
|
|
[1m:export-session-to[0m, [1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m,
|
|
|
[1m:redirect-to[0m, [1m:sh[0m, [1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-json-to[0m, [1m:write-jsonlines-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-view-to[0m, [1m:write-view-to[0m,
|
|
|
[1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write marked lines to the file /tmp/interesting-lines.txt:
|
|
|
[37m[40m:[0m[1m[36m[40mwrite-to[0m[37m[40m /tmp/interesting-lines.txt [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mwrite-view-to[0m[4m [[0m[4m--anonymize[0m[4m] [0m[4mpath[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Write the text in the top view to the given file without any
|
|
|
formatting
|
|
|
[4mParameters[0m
|
|
|
[4m--anonymize[0m Anonymize the lines
|
|
|
[4mpath[0m The path to the file to write
|
|
|
[4mSee Also[0m
|
|
|
[1m:alt-msg[0m, [1m:append-to[0m, [1m:cd[0m, [1m:create-logline-table[0m, [1m:create-search-table[0m,
|
|
|
[1m:echo[0m, [1m:echo[0m, [1m:eval[0m, [1m:export-session-to[0m, [1m:export-session-to[0m,
|
|
|
[1m:pipe-line-to[0m, [1m:pipe-to[0m, [1m:rebuild[0m, [1m:redirect-to[0m, [1m:redirect-to[0m, [1m:sh[0m,
|
|
|
[1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m,
|
|
|
[1m:write-json-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-jsonlines-to[0m, [1m:write-jsonlines-to[0m, [1m:write-raw-to[0m, [1m:write-raw-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m, [1m:write-screen-to[0m,
|
|
|
[1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-table-to[0m, [1m:write-to[0m,
|
|
|
[1m:write-to[0m, [1mecholn()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To write the top view to /tmp/table.txt:
|
|
|
[37m[40m:[0m[1m[36m[40mwrite-view-to[0m[37m[40m /tmp/table.txt [0m
|
|
|
|
|
|
|
|
|
|
|
|
[4m:[0m[1m[4mzoom-to[0m[4m [0m[4mzoom-level[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Zoom the histogram view to the given level
|
|
|
[4mParameter[0m
|
|
|
[4mzoom-level[0m The zoom level
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To set the zoom level to '1-week':
|
|
|
[37m[40m:[0m[1m[36m[40mzoom-to[0m[37m[40m 1-week [0m
|
|
|
|
|
|
|
|
|
[1mSQL Reference[0m
|
|
|
|
|
|
[1m[4mCAST[0m[4m([0m[4mexpr[0m[4m [0m[1m[4mAS[0m[4m [0m[4mtype-name[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Convert the value of the given expression to a different storage
|
|
|
class specified by type-name.
|
|
|
[4mParameters[0m
|
|
|
[4mexpr[0m The value to convert.
|
|
|
[4mtype-name[0m The name of the type to convert to.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To cast the value 1.23 as an integer:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[36m[40mCAST[0m[37m[40m([0m[1m[37m[40m1.23[0m[37m[40m [0m[1m[36m[40mAS[0m[37m[40m [0m[37m[40mINTEGER[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1mOVER[0m([[4mbase-window-name[0m] [1mPARTITION BY[0m [4mexpr[0m, ... [1mORDER BY[0m [4mexpr[0m, ...,
|
|
|
[4m [0m[4m[[0m[4mframe-spec[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Executes the preceding function over a window
|
|
|
[4mParameters[0m
|
|
|
[4mbase-window-name[0m The name of the window
|
|
|
definition
|
|
|
[4mexpr[0m The values to use for
|
|
|
partitioning
|
|
|
[4mexpr[0m The values used to order the
|
|
|
rows in the window
|
|
|
[4mframe-spec[0m Determines which output rows
|
|
|
are read by an aggregate window function
|
|
|
|
|
|
|
|
|
[1m[4mabs[0m[4m([0m[4mx[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Return the absolute value of the argument
|
|
|
[4mParameter[0m
|
|
|
[4mx[0m The number to convert
|
|
|
[4mSee Also[0m
|
|
|
[1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m, [1matn2()[0m,
|
|
|
[1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the absolute value of -1:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mabs[0m[37m[40m([0m[1m[37m[40m-1[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4macos[0m[4m([0m[4mnum[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the arccosine of a number, in radians
|
|
|
[4mParameter[0m
|
|
|
[4mnum[0m A cosine value that is between -1 and 1
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m, [1matn2()[0m,
|
|
|
[1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the arccosine of 0.2:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40macos[0m[37m[40m([0m[1m[37m[40m0.2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4macosh[0m[4m([0m[4mnum[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the hyperbolic arccosine of a number
|
|
|
[4mParameter[0m
|
|
|
[4mnum[0m A number that is one or more
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m, [1matn2()[0m,
|
|
|
[1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the hyperbolic arccosine of 1.2:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40macosh[0m[37m[40m([0m[1m[37m[40m1.2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4manonymize[0m[4m([0m[4mvalue[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Replace identifying information with random values.
|
|
|
[4mParameter[0m
|
|
|
[4mvalue[0m The text to anonymize
|
|
|
[4mSee Also[0m
|
|
|
[1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m, [1mextract()[0m,
|
|
|
[1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To anonymize an IP address:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40manonymize[0m[37m[40m([0m[35m[40m'Hello, 192.168.1.2'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4masin[0m[4m([0m[4mnum[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the arcsine of a number, in radians
|
|
|
[4mParameter[0m
|
|
|
[4mnum[0m A sine value that is between -1 and 1
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m, [1matn2()[0m,
|
|
|
[1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the arcsine of 0.2:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40masin[0m[37m[40m([0m[1m[37m[40m0.2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4masinh[0m[4m([0m[4mnum[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the hyperbolic arcsine of a number
|
|
|
[4mParameter[0m
|
|
|
[4mnum[0m The number
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m, [1matn2()[0m,
|
|
|
[1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the hyperbolic arcsine of 0.2:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40masinh[0m[37m[40m([0m[1m[37m[40m0.2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4matan[0m[4m([0m[4mnum[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the arctangent of a number, in radians
|
|
|
[4mParameter[0m
|
|
|
[4mnum[0m The number
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan2()[0m, [1matanh()[0m, [1matn2()[0m,
|
|
|
[1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the arctangent of 0.2:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40matan[0m[37m[40m([0m[1m[37m[40m0.2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4matan2[0m[4m([0m[4my[0m[4m, [0m[4mx[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the angle in the plane between the positive X axis and the
|
|
|
ray from (0, 0) to the point (x, y)
|
|
|
[4mParameters[0m
|
|
|
[4my[0m The y coordinate of the point
|
|
|
[4mx[0m The x coordinate of the point
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matanh()[0m, [1matn2()[0m,
|
|
|
[1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the angle, in degrees, for the point at (5, 5):
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdegrees[0m[37m[40m([0m[1m[37m[40matan2[0m[37m[40m([0m[1m[37m[40m5[0m[37m[40m, [0m[1m[37m[40m5[0m[37m[40m)) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4matanh[0m[4m([0m[4mnum[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the hyperbolic arctangent of a number
|
|
|
[4mParameter[0m
|
|
|
[4mnum[0m The number
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matn2()[0m,
|
|
|
[1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the hyperbolic arctangent of 0.2:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40matanh[0m[37m[40m([0m[1m[37m[40m0.2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4matn2[0m[4m([0m[4my[0m[4m, [0m[4mx[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the angle in the plane between the positive X axis and the
|
|
|
ray from (0, 0) to the point (x, y)
|
|
|
[4mParameters[0m
|
|
|
[4my[0m The y coordinate of the point
|
|
|
[4mx[0m The x coordinate of the point
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the angle, in degrees, for the point at (5, 5):
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdegrees[0m[37m[40m([0m[1m[37m[40matn2[0m[37m[40m([0m[1m[37m[40m5[0m[37m[40m, [0m[1m[37m[40m5[0m[37m[40m)) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mavg[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the average value of all non-NULL numbers within a group.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The value to compute the average of.
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m,
|
|
|
[1mmin()[0m, [1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the average of the column 'ex_duration' from the table 'lnav_example_log':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mavg[0m[37m[40m([0m[37m[40mex_duration[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
#2 To get the average of the column 'ex_duration' from the table 'lnav_example_log'
|
|
|
when grouped by 'ex_procname':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[37m[40mex_procname[0m[37m[40m, [0m[1m[37m[40mavg[0m[37m[40m([0m[37m[40mex_duration[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m[37m[40m [0m[1m[36m[40mGROUP[0m[37m[40m [0m[1m[36m[40mBY[0m[37m[40m [0m[37m[40mex_procname[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mbasename[0m[4m([0m[4mpath[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Extract the base portion of a pathname.
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m The path
|
|
|
[4mSee Also[0m
|
|
|
[1mdirname()[0m, [1mjoinpath()[0m, [1mreadlink()[0m, [1mrealpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the base of a plain file name:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mbasename[0m[37m[40m([0m[35m[40m'foobar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the base of a path:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mbasename[0m[37m[40m([0m[35m[40m'foo/bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To get the base of a directory:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mbasename[0m[37m[40m([0m[35m[40m'foo/bar/'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#4 To get the base of an empty string:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mbasename[0m[37m[40m([0m[35m[40m''[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#5 To get the base of a Windows path:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mbasename[0m[37m[40m([0m[35m[40m'foo\bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#6 To get the base of the root directory:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mbasename[0m[37m[40m([0m[35m[40m'/'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mceil[0m[4m([0m[4mnum[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the smallest integer that is not less than the argument
|
|
|
[4mParameter[0m
|
|
|
[4mnum[0m The number to raise to the ceiling
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the ceiling of 1.23:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mceil[0m[37m[40m([0m[1m[37m[40m1.23[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mchanges[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
The number of database rows that were changed, inserted, or
|
|
|
deleted by the most recent statement.
|
|
|
|
|
|
|
|
|
[1m[4mchar[0m[4m([0m[4mX[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a string composed of characters having the given unicode
|
|
|
code point values
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The unicode code point values
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m, [1mextract()[0m,
|
|
|
[1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get a string with the code points 0x48 and 0x49:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mchar[0m[37m[40m([0m[1m[37m[40m0x48[0m[37m[40m, [0m[1m[37m[40m0x49[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mcharindex[0m[4m([0m[4mneedle[0m[4m, [0m[4mhaystack[0m[4m, [[0m[4mstart[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Finds the first occurrence of the needle within the haystack and
|
|
|
returns the number of prior characters plus 1, or 0 if Y is nowhere
|
|
|
found within X
|
|
|
[4mParameters[0m
|
|
|
[4mneedle[0m The string to look for in the haystack
|
|
|
[4mhaystack[0m The string to search within
|
|
|
[4mstart[0m The one-based index within the haystack to
|
|
|
start the search
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m, [1mextract()[0m,
|
|
|
[1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To search for the string 'abc' within 'abcabc' and starting at position 2:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mcharindex[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[35m[40m'abcabc'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To search for the string 'abc' within 'abcdef' and starting at position 2:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mcharindex[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[35m[40m'abcdef'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mcoalesce[0m[4m([0m[4mX[0m[4m, [0m[4mY[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a copy of its first non-NULL argument, or NULL if all
|
|
|
arguments are NULL
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m A value to check for NULL-ness
|
|
|
[4mY[0m A value to check for NULL-ness
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To get the first non-null value from three parameters:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mcoalesce[0m[37m[40m([0m[1m[36m[40mnull[0m[37m[40m, [0m[1m[37m[40m0[0m[37m[40m, [0m[1m[36m[40mnull[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mcount[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
If the argument is '*', the total number of rows in the group is
|
|
|
returned. Otherwise, the number of times the argument is non-NULL.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The value to count.
|
|
|
|
|
|
[4mExamples[0m
|
|
|
#1 To get the count of the non-NULL rows of 'lnav_example_log':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mcount[0m[37m[40m([0m[1m[37m[40m*[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
#2 To get the count of the non-NULL values of 'log_part' from 'lnav_example_log':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mcount[0m[37m[40m([0m[37m[40mlog_part[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mcume_dist[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the cumulative distribution
|
|
|
[4mSee Also[0m
|
|
|
[1mdense_rank()[0m, [1mfirst_value()[0m, [1mlag()[0m, [1mlast_value()[0m, [1mlead()[0m, [1mnth_value()[0m,
|
|
|
[1mntile()[0m, [1mpercent_rank()[0m, [1mrank()[0m, [1mrow_number()[0m
|
|
|
|
|
|
[1m[4mdate[0m[4m([0m[4mtimestring[0m[4m, [0m[4mmodifier[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the date in this format: YYYY-MM-DD.
|
|
|
[4mParameters[0m
|
|
|
[4mtimestring[0m The string to convert to a date.
|
|
|
[4mmodifier[0m A transformation that is applied to the
|
|
|
value to the left.
|
|
|
[4mSee Also[0m
|
|
|
[1mdatetime()[0m, [1mhumanize_duration()[0m, [1mjulianday()[0m, [1mstrftime()[0m, [1mtime()[0m,
|
|
|
[1mtimediff()[0m, [1mtimeslice()[0m, [1mtimezone()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the date portion of the timestamp '2017-01-02T03:04:05':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdate[0m[37m[40m([0m[35m[40m'2017-01-02T03:04:05'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the date portion of the timestamp '2017-01-02T03:04:05' plus one day:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdate[0m[37m[40m([0m[35m[40m'2017-01-02T03:04:05'[0m[37m[40m, [0m[35m[40m'+1 day'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To get the date portion of the epoch timestamp 1491341842:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdate[0m[37m[40m([0m[1m[37m[40m1491341842[0m[37m[40m, [0m[35m[40m'unixepoch'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mdatetime[0m[4m([0m[4mtimestring[0m[4m, [0m[4mmodifier[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the date and time in this format: YYYY-MM-DD HH:MM:SS.
|
|
|
[4mParameters[0m
|
|
|
[4mtimestring[0m The string to convert to a date with
|
|
|
time.
|
|
|
[4mmodifier[0m A transformation that is applied to the
|
|
|
value to the left.
|
|
|
[4mSee Also[0m
|
|
|
[1mdate()[0m, [1mhumanize_duration()[0m, [1mjulianday()[0m, [1mstrftime()[0m, [1mtime()[0m,
|
|
|
[1mtimediff()[0m, [1mtimeslice()[0m, [1mtimezone()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the date and time portion of the timestamp '2017-01-02T03:04:05':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdatetime[0m[37m[40m([0m[35m[40m'2017-01-02T03:04:05'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the date and time portion of the timestamp '2017-01-02T03:04:05' plus one
|
|
|
minute:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdatetime[0m[37m[40m([0m[35m[40m'2017-01-02T03:04:05'[0m[37m[40m, [0m[35m[40m'+1 minute'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#3 To get the date and time portion of the epoch timestamp 1491341842:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdatetime[0m[37m[40m([0m[1m[37m[40m1491341842[0m[37m[40m, [0m[35m[40m'unixepoch'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mdecode[0m[4m([0m[4mvalue[0m[4m, [0m[4malgorithm[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Decode the value using the given algorithm
|
|
|
[4mParameters[0m
|
|
|
[4mvalue[0m The value to decode
|
|
|
[4malgorithm[0m One of the following encoding algorithms:
|
|
|
base64, hex, uri
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mencode()[0m, [1mendswith()[0m, [1mextract()[0m,
|
|
|
[1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To decode the URI-encoded string '%63%75%72%6c':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdecode[0m[37m[40m([0m[35m[40m'%63%75%72%6c'[0m[37m[40m, [0m[35m[40m'uri'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mdegrees[0m[4m([0m[4mradians[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Converts radians to degrees
|
|
|
[4mParameter[0m
|
|
|
[4mradians[0m The radians value to convert to degrees
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To convert PI to degrees:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdegrees[0m[37m[40m([0m[1m[37m[40mpi[0m[37m[40m()) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mdense_rank[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the row_number() of the first peer in each group without
|
|
|
gaps
|
|
|
[4mSee Also[0m
|
|
|
[1mcume_dist()[0m, [1mfirst_value()[0m, [1mlag()[0m, [1mlast_value()[0m, [1mlead()[0m, [1mnth_value()[0m,
|
|
|
[1mntile()[0m, [1mpercent_rank()[0m, [1mrank()[0m, [1mrow_number()[0m
|
|
|
|
|
|
[1m[4mdirname[0m[4m([0m[4mpath[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Extract the directory portion of a pathname.
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m The path
|
|
|
[4mSee Also[0m
|
|
|
[1mbasename()[0m, [1mjoinpath()[0m, [1mreadlink()[0m, [1mrealpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the directory of a relative file path:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdirname[0m[37m[40m([0m[35m[40m'foo/bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the directory of an absolute file path:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdirname[0m[37m[40m([0m[35m[40m'/foo/bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To get the directory of a file in the root directory:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdirname[0m[37m[40m([0m[35m[40m'/bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#4 To get the directory of a Windows path:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdirname[0m[37m[40m([0m[35m[40m'foo\bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#5 To get the directory of an empty path:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mdirname[0m[37m[40m([0m[35m[40m''[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mecholn[0m[4m([0m[4mvalue[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Echo the argument to the current output file and return it
|
|
|
[4mParameter[0m
|
|
|
[4mvalue[0m The value to write to the current output file
|
|
|
[4mSee Also[0m
|
|
|
[1m:append-to[0m, [1m:echo[0m, [1m:export-session-to[0m, [1m:pipe-line-to[0m, [1m:pipe-to[0m,
|
|
|
[1m:redirect-to[0m, [1m:write-csv-to[0m, [1m:write-json-to[0m, [1m:write-jsonlines-to[0m,
|
|
|
[1m:write-raw-to[0m, [1m:write-screen-to[0m, [1m:write-table-to[0m, [1m:write-to[0m,
|
|
|
[1m:write-view-to[0m
|
|
|
|
|
|
[1m[4mencode[0m[4m([0m[4mvalue[0m[4m, [0m[4malgorithm[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Encode the value using the given algorithm
|
|
|
[4mParameters[0m
|
|
|
[4mvalue[0m The value to encode
|
|
|
[4malgorithm[0m One of the following encoding algorithms:
|
|
|
base64, hex, uri
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mendswith()[0m, [1mextract()[0m,
|
|
|
[1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To base64-encode 'Hello, World!':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mencode[0m[37m[40m([0m[35m[40m'Hello, World!'[0m[37m[40m, [0m[35m[40m'base64'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To hex-encode 'Hello, World!':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mencode[0m[37m[40m([0m[35m[40m'Hello, World!'[0m[37m[40m, [0m[35m[40m'hex'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To URI-encode 'Hello, World!':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mencode[0m[37m[40m([0m[35m[40m'Hello, World!'[0m[37m[40m, [0m[35m[40m'uri'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mendswith[0m[4m([0m[4mstr[0m[4m, [0m[4msuffix[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Test if a string ends with the given suffix
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to test
|
|
|
[4msuffix[0m The suffix to check in the string
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mextract()[0m,
|
|
|
[1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To test if the string 'notbad.jpg' ends with '.jpg':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mendswith[0m[37m[40m([0m[35m[40m'notbad.jpg'[0m[37m[40m, [0m[35m[40m'.jpg'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To test if the string 'notbad.png' starts with '.jpg':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mendswith[0m[37m[40m([0m[35m[40m'notbad.png'[0m[37m[40m, [0m[35m[40m'.jpg'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mexp[0m[4m([0m[4mx[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the value of e raised to the power of x
|
|
|
[4mParameter[0m
|
|
|
[4mx[0m The exponent
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m,
|
|
|
[1mmin()[0m, [1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To raise e to 2:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mexp[0m[37m[40m([0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mextract[0m[4m([0m[4mstr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Automatically Parse and extract data from a string
|
|
|
[4mParameter[0m
|
|
|
[4mstr[0m The string to parse
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To extract key/value pairs from a string:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mextract[0m[37m[40m([0m[35m[40m'foo=1 bar=2 name="Rolo Tomassi"'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To extract columnar data from a string:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mextract[0m[37m[40m([0m[35m[40m'1.0 abc 2.0'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mfirst_value[0m[4m([0m[4mexpr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the result of evaluating the expression against the first
|
|
|
row in the window frame.
|
|
|
[4mParameter[0m
|
|
|
[4mexpr[0m The expression to execute over the first row
|
|
|
[4mSee Also[0m
|
|
|
[1mcume_dist()[0m, [1mdense_rank()[0m, [1mlag()[0m, [1mlast_value()[0m, [1mlead()[0m, [1mnth_value()[0m,
|
|
|
[1mntile()[0m, [1mpercent_rank()[0m, [1mrank()[0m, [1mrow_number()[0m
|
|
|
|
|
|
[1m[4mfloor[0m[4m([0m[4mnum[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the largest integer that is not greater than the argument
|
|
|
[4mParameter[0m
|
|
|
[4mnum[0m The number to lower to the floor
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mlog()[0m, [1mlog10()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the floor of 1.23:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mfloor[0m[37m[40m([0m[1m[37m[40m1.23[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mfstat[0m[4m([0m[4mpattern[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
A table-valued function for getting information about file
|
|
|
paths/globs
|
|
|
[4mParameter[0m
|
|
|
[4mpattern[0m The file path or glob pattern to query.
|
|
|
[4mResults[0m
|
|
|
[4mst_parent[0m The parent path of the directory entry
|
|
|
[4mst_name[0m The name of the directory entry
|
|
|
[4mst_dev[0m The device number
|
|
|
[4mst_ino[0m The inode number
|
|
|
[4mst_type[0m The type of the entry
|
|
|
[4mst_mode[0m The protection mode
|
|
|
[4mst_nlink[0m The number of hard links to the entry
|
|
|
[4mst_uid[0m The ID of the owning user
|
|
|
[4mst_user[0m The user name
|
|
|
[4mst_gid[0m The ID of the owning group
|
|
|
[4mst_group[0m The group name
|
|
|
[4mst_rdev[0m The device type
|
|
|
[4mst_size[0m The size of the entry in bytes
|
|
|
[4mst_blksize[0m The optimal size for I/O
|
|
|
[4mst_blocks[0m Blocks allocated for the file
|
|
|
[4mst_atime[0m The last access time
|
|
|
[4mst_mtime[0m The last modified time
|
|
|
[4mst_ctime[0m The creation time
|
|
|
[4merror[0m Error message if there was a problem
|
|
|
looking up the entry
|
|
|
[4mdata[0m The contents of the file
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To read a file and raise an error if there is a problem:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mifnull[0m[37m[40m([0m[37m[40mdata[0m[37m[40m, [0m[1m[37m[40mraise_error[0m[37m[40m([0m[35m[40m'cannot read: '[0m[37m[40m [0m[1m[37m[40m||[0m[37m[40m [0m[37m[40mst_name[0m[37m[40m, [0m[37m[40merror[0m[37m[40m)) [0m[1m[36m[40mFROM[0m
|
|
|
[37m[40m [0m[1m[37m[40mfstat[0m[37m[40m([0m[35m[40m'/non-existent'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mgenerate_series[0m[4m([0m[4mstart[0m[4m, [0m[4mstop[0m[4m, [[0m[4mstep[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
A table-valued-function that returns the whole numbers between a
|
|
|
lower and upper bound, inclusive
|
|
|
[4mParameters[0m
|
|
|
[4mstart[0m The starting point of the series
|
|
|
[4mstop[0m The stopping point of the series
|
|
|
[4mstep[0m The increment between each value
|
|
|
[4mResult[0m
|
|
|
[4mvalue[0m The number in the series
|
|
|
|
|
|
[4mExamples[0m
|
|
|
#1 To generate the numbers in the range [10, 14]:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[37m[40mvalue[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[1m[37m[40mgenerate_series[0m[37m[40m([0m[1m[37m[40m10[0m[37m[40m, [0m[1m[37m[40m14[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To generate every other number in the range [10, 14]:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[37m[40mvalue[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[1m[37m[40mgenerate_series[0m[37m[40m([0m[1m[37m[40m10[0m[37m[40m, [0m[1m[37m[40m14[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To count down from five to 1:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[37m[40mvalue[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[1m[37m[40mgenerate_series[0m[37m[40m([0m[1m[37m[40m1[0m[37m[40m, [0m[1m[37m[40m5[0m[37m[40m, [0m[1m[37m[40m-1[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mgethostbyaddr[0m[4m([0m[4mhostname[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Get the hostname for the given IP address
|
|
|
[4mParameter[0m
|
|
|
[4mhostname[0m The IP address to lookup.
|
|
|
[4mSee Also[0m
|
|
|
[1mgethostbyname()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the hostname for the IP '127.0.0.1':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mgethostbyaddr[0m[37m[40m([0m[35m[40m'127.0.0.1'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mgethostbyname[0m[4m([0m[4mhostname[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Get the IP address for the given hostname
|
|
|
[4mParameter[0m
|
|
|
[4mhostname[0m The DNS hostname to lookup.
|
|
|
[4mSee Also[0m
|
|
|
[1mgethostbyaddr()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the IP address for 'localhost':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mgethostbyname[0m[37m[40m([0m[35m[40m'localhost'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mglob[0m[4m([0m[4mpattern[0m[4m, [0m[4mstr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Match a string against Unix glob pattern
|
|
|
[4mParameters[0m
|
|
|
[4mpattern[0m The glob pattern
|
|
|
[4mstr[0m The string to match
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To test if the string 'abc' matches the glob 'a*':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[36m[40mglob[0m[37m[40m([0m[35m[40m'a*'[0m[37m[40m, [0m[35m[40m'abc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mgroup_concat[0m[4m([0m[4mX[0m[4m, [[0m[4msep[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a string which is the concatenation of all non-NULL values
|
|
|
of X separated by a comma or the given separator.
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The value to concatenate.
|
|
|
[4msep[0m The separator to place between the values.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m, [1mhumanize_duration()[0m,
|
|
|
[1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m, [1mlength()[0m, [1mlogfmt2json()[0m,
|
|
|
[1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m, [1mprintf()[0m,
|
|
|
[1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m, [1mregexp_match()[0m,
|
|
|
[1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m,
|
|
|
[1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m,
|
|
|
[1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m, [1mupper()[0m,
|
|
|
[1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To concatenate the values of the column 'ex_procname' from the table
|
|
|
'lnav_example_log':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mgroup_concat[0m[37m[40m([0m[37m[40mex_procname[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m
|
|
|
|
|
|
|
|
|
#2 To join the values of the column 'ex_procname' using the string ', ':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mgroup_concat[0m[37m[40m([0m[37m[40mex_procname[0m[37m[40m, [0m[35m[40m', '[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m
|
|
|
|
|
|
|
|
|
#3 To concatenate the distinct values of the column 'ex_procname' from the table
|
|
|
'lnav_example_log':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mgroup_concat[0m[37m[40m([0m[1m[36m[40mDISTINCT[0m[37m[40m [0m[37m[40mex_procname[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mgroup_spooky_hash[0m[4m([0m[4mstr[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Compute the hash value for the given arguments
|
|
|
[4mParameter[0m
|
|
|
[4mstr[0m The string to hash
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgunzip()[0m, [1mgzip()[0m, [1mhumanize_duration()[0m,
|
|
|
[1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m, [1mlength()[0m, [1mlogfmt2json()[0m,
|
|
|
[1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m, [1mprintf()[0m,
|
|
|
[1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m, [1mregexp_match()[0m,
|
|
|
[1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m,
|
|
|
[1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m,
|
|
|
[1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m, [1mupper()[0m,
|
|
|
[1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To produce a hash of all of the values of 'column1':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mgroup_spooky_hash[0m[37m[40m([0m[37m[40mcolumn1[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m ([0m[1m[36m[40mVALUES[0m[37m[40m ([0m[35m[40m'abc'[0m[37m[40m), ([0m[35m[40m'123'[0m[37m[40m))[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mgunzip[0m[4m([0m[4mb[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Decompress a gzip file
|
|
|
[4mParameter[0m
|
|
|
[4mb[0m The blob to decompress
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
|
|
|
[1m[4mgzip[0m[4m([0m[4mvalue[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Compress a string into a gzip file
|
|
|
[4mParameter[0m
|
|
|
[4mvalue[0m The value to compress
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
|
|
|
[1m[4mhex[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a string which is the upper-case hexadecimal rendering of
|
|
|
the content of its argument.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The blob to convert to hexadecimal
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To get the hexadecimal rendering of the string 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mhex[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mhumanize_duration[0m[4m([0m[4msecs[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Format the given seconds value as an abbreviated duration string
|
|
|
[4mParameter[0m
|
|
|
[4msecs[0m The duration in seconds
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdate()[0m, [1mdatetime()[0m, [1mdecode()[0m,
|
|
|
[1mencode()[0m, [1mendswith()[0m, [1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m,
|
|
|
[1mgunzip()[0m, [1mgzip()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mjulianday()[0m,
|
|
|
[1mleftstr()[0m, [1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m,
|
|
|
[1mpadr()[0m, [1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1mstrftime()[0m, [1msubstr()[0m, [1mtime()[0m,
|
|
|
[1mtimediff()[0m, [1mtimeslice()[0m, [1mtimezone()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m,
|
|
|
[1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To format a duration:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mhumanize_duration[0m[37m[40m([0m[1m[37m[40m15[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[37m[40m60[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To format a sub-second value:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mhumanize_duration[0m[37m[40m([0m[1m[37m[40m1.5[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mhumanize_file_size[0m[4m([0m[4mvalue[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Format the given file size as a human-friendly string
|
|
|
[4mParameter[0m
|
|
|
[4mvalue[0m The file size to format
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1minstr()[0m, [1mleftstr()[0m, [1mlength()[0m, [1mlogfmt2json()[0m,
|
|
|
[1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m, [1mprintf()[0m,
|
|
|
[1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m, [1mregexp_match()[0m,
|
|
|
[1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m,
|
|
|
[1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m,
|
|
|
[1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m, [1mupper()[0m,
|
|
|
[1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To format an amount:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mhumanize_file_size[0m[37m[40m([0m[1m[37m[40m10[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[37m[40m1024[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[37m[40m1024[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mifnull[0m[4m([0m[4mX[0m[4m, [0m[4mY[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a copy of its first non-NULL argument, or NULL if both
|
|
|
arguments are NULL
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m A value to check for NULL-ness
|
|
|
[4mY[0m A value to check for NULL-ness
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To get the first non-null value between null and zero:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mifnull[0m[37m[40m([0m[1m[36m[40mnull[0m[37m[40m, [0m[1m[37m[40m0[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4minstr[0m[4m([0m[4mhaystack[0m[4m, [0m[4mneedle[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Finds the first occurrence of the needle within the haystack and
|
|
|
returns the number of prior characters plus 1, or 0 if the needle
|
|
|
was not found
|
|
|
[4mParameters[0m
|
|
|
[4mhaystack[0m The string to search within
|
|
|
[4mneedle[0m The string to look for in the haystack
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1mleftstr()[0m, [1mlength()[0m,
|
|
|
[1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To test get the position of 'b' in the string 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40minstr[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[35m[40m'b'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjget[0m[4m([0m[4mjson[0m[4m, [0m[4mptr[0m[4m, [[0m[4mdefault[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Get the value from a JSON object using a JSON-Pointer.
|
|
|
[4mParameters[0m
|
|
|
[4mjson[0m The JSON object to query.
|
|
|
[4mptr[0m The JSON-Pointer to lookup in the object.
|
|
|
[4mdefault[0m The default value if the value was not found
|
|
|
[4mSee Also[0m
|
|
|
[1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m,
|
|
|
[1mjson_remove()[0m, [1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m,
|
|
|
[1mjson_valid()[0m, [1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the root of a JSON value:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjget[0m[37m[40m([0m[35m[40m'1'[0m[37m[40m, [0m[35m[40m''[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the property named 'b' in a JSON object:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjget[0m[37m[40m([0m[35m[40m'{ "a": 1, "b": 2 }'[0m[37m[40m, [0m[35m[40m'/b'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To get the 'msg' property and return a default if it does not exist:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjget[0m[37m[40m([0m[1m[36m[40mnull[0m[37m[40m, [0m[35m[40m'/msg'[0m[37m[40m, [0m[35m[40m'Hello'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjoinpath[0m[4m([0m[4mpath[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Join components of a path together.
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m One or more path components to join together. If an
|
|
|
argument starts with a forward or backward slash, it will be
|
|
|
considered an absolute path and any preceding elements will
|
|
|
be ignored.
|
|
|
[4mSee Also[0m
|
|
|
[1mbasename()[0m, [1mdirname()[0m, [1mreadlink()[0m, [1mrealpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To join a directory and file name into a relative path:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjoinpath[0m[37m[40m([0m[35m[40m'foo'[0m[37m[40m, [0m[35m[40m'bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To join an empty component with other names into a relative path:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjoinpath[0m[37m[40m([0m[35m[40m''[0m[37m[40m, [0m[35m[40m'foo'[0m[37m[40m, [0m[35m[40m'bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To create an absolute path with two path components:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjoinpath[0m[37m[40m([0m[35m[40m'/'[0m[37m[40m, [0m[35m[40m'foo'[0m[37m[40m, [0m[35m[40m'bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#4 To create an absolute path from a path component that starts with a forward slash:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjoinpath[0m[37m[40m([0m[35m[40m'/'[0m[37m[40m, [0m[35m[40m'foo'[0m[37m[40m, [0m[35m[40m'/bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Verifies that its argument is valid JSON and returns a minified
|
|
|
version or throws an error.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The string to interpret as JSON.
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m,
|
|
|
[1mjson_remove()[0m, [1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m,
|
|
|
[1mjson_valid()[0m, [1myaml_to_json()[0m
|
|
|
|
|
|
[1m[4mjson_array[0m[4m([0m[4mX[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Constructs a JSON array from its arguments.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The values of the JSON array
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m, [1mjson_contains()[0m,
|
|
|
[1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m, [1mjson_group_object()[0m,
|
|
|
[1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m, [1mjson_remove()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To create an array of all types:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_array[0m[37m[40m([0m[1m[36m[40mNULL[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m, [0m[1m[37m[40m2.1[0m[37m[40m, [0m[35m[40m'three'[0m[37m[40m, [0m[1m[37m[40mjson_array[0m[37m[40m([0m[1m[37m[40m4[0m[37m[40m), [0m[1m[37m[40mjson_object[0m[37m[40m([0m[35m[40m'five'[0m[37m[40m, [0m[35m[40m'six'[0m[37m[40m))[0m
|
|
|
|
|
|
|
|
|
#2 To create an empty array:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_array[0m[37m[40m() [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_array_length[0m[4m([0m[4mX[0m[4m, [[0m[4mP[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the length of a JSON array.
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The JSON object.
|
|
|
[4mP[0m The path to the array in 'X'.
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_concat()[0m, [1mjson_contains()[0m,
|
|
|
[1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m, [1mjson_group_object()[0m,
|
|
|
[1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m, [1mjson_remove()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the length of an array:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_array_length[0m[37m[40m([0m[35m[40m'[1, 2, 3]'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the length of a nested array:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_array_length[0m[37m[40m([0m[35m[40m'{"arr": [1, 2, 3]}'[0m[37m[40m, [0m[35m[40m'$.arr'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_concat[0m[4m([0m[4mjson[0m[4m, [0m[4mvalue[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns an array with the given values concatenated onto the end.
|
|
|
If the initial value is null, the result will be an array with the
|
|
|
given elements. If the initial value is an array, the result will
|
|
|
be an array with the given values at the end. If the initial value
|
|
|
is not null or an array, the result will be an array with two
|
|
|
elements: the initial value and the given value.
|
|
|
[4mParameters[0m
|
|
|
[4mjson[0m The initial JSON value.
|
|
|
[4mvalue[0m The value(s) to add to the end of the array.
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_contains()[0m,
|
|
|
[1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m, [1mjson_group_object()[0m,
|
|
|
[1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m, [1mjson_remove()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To append the number 4 to null:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_concat[0m[37m[40m([0m[1m[36m[40mNULL[0m[37m[40m, [0m[1m[37m[40m4[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To append 4 and 5 to the array [1, 2, 3]:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_concat[0m[37m[40m([0m[35m[40m'[1, 2, 3]'[0m[37m[40m, [0m[1m[37m[40m4[0m[37m[40m, [0m[1m[37m[40m5[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To concatenate two arrays together:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_concat[0m[37m[40m([0m[35m[40m'[1, 2, 3]'[0m[37m[40m, [0m[1m[37m[40mjson[0m[37m[40m([0m[35m[40m'[4, 5]'[0m[37m[40m)) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_contains[0m[4m([0m[4mjson[0m[4m, [0m[4mvalue[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Check if a JSON value contains the given element.
|
|
|
[4mParameters[0m
|
|
|
[4mjson[0m The JSON value to query.
|
|
|
[4mvalue[0m The value to look for in the first argument
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m, [1mjson_group_object()[0m,
|
|
|
[1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m, [1mjson_remove()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To test if a JSON array contains the number 4:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_contains[0m[37m[40m([0m[35m[40m'[1, 2, 3]'[0m[37m[40m, [0m[1m[37m[40m4[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To test if a JSON array contains the string 'def':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_contains[0m[37m[40m([0m[35m[40m'["abc", "def"]'[0m[37m[40m, [0m[35m[40m'def'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_each[0m[4m([0m[4mX[0m[4m, [[0m[4mP[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
A table-valued-function that returns the children of the top-level
|
|
|
JSON value
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The JSON value to query
|
|
|
[4mP[0m The path to the value to query
|
|
|
[4mResults[0m
|
|
|
[4mkey[0m The array index for elements of an array or
|
|
|
property names of the object
|
|
|
[4mvalue[0m The value for the current element
|
|
|
[4mtype[0m The type of the current element
|
|
|
[4matom[0m The SQL value of the element, if it is a
|
|
|
primitive type
|
|
|
[4mfullkey[0m The path to the current element
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m,
|
|
|
[1mjson_remove()[0m, [1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m,
|
|
|
[1mjson_valid()[0m, [1myaml_to_json()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To iterate over an array:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[1m[37m[40mjson_each[0m[37m[40m([0m[35m[40m'[null,1,"two",{"three":4.5}]'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_extract[0m[4m([0m[4mX[0m[4m, [0m[4mP[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the value(s) from the given JSON at the given path(s).
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The JSON value.
|
|
|
[4mP[0m The path to extract.
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_group_array()[0m, [1mjson_group_object()[0m,
|
|
|
[1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m, [1mjson_remove()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get a number:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_extract[0m[37m[40m([0m[35m[40m'{"num": 1}'[0m[37m[40m, [0m[35m[40m'$.num'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get two numbers:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_extract[0m[37m[40m([0m[35m[40m'{"num": 1, "val": 2}'[0m[37m[40m, [0m[35m[40m'$.num'[0m[37m[40m, [0m[35m[40m'$.val'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#3 To get an object:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_extract[0m[37m[40m([0m[35m[40m'{"obj": {"sub": 1}}'[0m[37m[40m, [0m[35m[40m'$.obj'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_group_array[0m[4m([0m[4mvalue[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Collect the given values from a query into a JSON array
|
|
|
[4mParameter[0m
|
|
|
[4mvalue[0m The values to append to the array
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_object()[0m,
|
|
|
[1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m, [1mjson_remove()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To create an array from arguments:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_group_array[0m[37m[40m([0m[35m[40m'one'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m, [0m[1m[37m[40m3.4[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To create an array from a column of values:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_group_array[0m[37m[40m([0m[37m[40mcolumn1[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m ([0m[1m[36m[40mVALUES[0m[37m[40m ([0m[1m[37m[40m1[0m[37m[40m), ([0m[1m[37m[40m2[0m[37m[40m), ([0m[1m[37m[40m3[0m[37m[40m))[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_group_object[0m[4m([0m[4mname[0m[4m, [0m[4mvalue[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Collect the given values from a query into a JSON object
|
|
|
[4mParameters[0m
|
|
|
[4mname[0m The property name for the value
|
|
|
[4mvalue[0m The value to add to the object
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m, [1mjson_remove()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To create an object from arguments:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_group_object[0m[37m[40m([0m[35m[40m'a'[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m, [0m[35m[40m'b'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To create an object from a pair of columns:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_group_object[0m[37m[40m([0m[37m[40mcolumn1[0m[37m[40m, [0m[37m[40mcolumn2[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m ([0m[1m[36m[40mVALUES[0m[37m[40m ([0m[35m[40m'a'[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m), ([0m[35m[40m'b'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m))[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_insert[0m[4m([0m[4mX[0m[4m, [0m[4mP[0m[4m, [0m[4mY[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Inserts values into a JSON object/array at the given locations, if
|
|
|
it does not already exist
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The JSON value to update
|
|
|
[4mP[0m The path to the insertion point. A '#' array index means
|
|
|
append the value
|
|
|
[4mY[0m The value to insert
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_object()[0m, [1mjson_quote()[0m, [1mjson_remove()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To append to an array:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_insert[0m[37m[40m([0m[35m[40m'[1, 2]'[0m[37m[40m, [0m[35m[40m'$[#]'[0m[37m[40m, [0m[1m[37m[40m3[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To update an object:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_insert[0m[37m[40m([0m[35m[40m'{"a": 1}'[0m[37m[40m, [0m[35m[40m'$.b'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To ensure a value is set:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_insert[0m[37m[40m([0m[35m[40m'{"a": 1}'[0m[37m[40m, [0m[35m[40m'$.a'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#4 To update multiple values:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_insert[0m[37m[40m([0m[35m[40m'{"a": 1}'[0m[37m[40m, [0m[35m[40m'$.b'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m, [0m[35m[40m'$.c'[0m[37m[40m, [0m[1m[37m[40m3[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_object[0m[4m([0m[4mN[0m[4m, [0m[4mV[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Create a JSON object from the given arguments
|
|
|
[4mParameters[0m
|
|
|
[4mN[0m The property name
|
|
|
[4mV[0m The property value
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_quote()[0m, [1mjson_remove()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To create an object:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_object[0m[37m[40m([0m[35m[40m'a'[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m, [0m[35m[40m'b'[0m[37m[40m, [0m[35m[40m'c'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To create an empty object:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_object[0m[37m[40m() [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_quote[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the JSON representation of the given value, if it is not
|
|
|
already JSON
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The value to convert
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_remove()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To convert a string:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_quote[0m[37m[40m([0m[35m[40m'Hello, World!'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To pass through an existing JSON value:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_quote[0m[37m[40m([0m[1m[37m[40mjson[0m[37m[40m([0m[35m[40m'"Hello, World!"'[0m[37m[40m)) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_remove[0m[4m([0m[4mX[0m[4m, [0m[4mP[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Removes paths from a JSON value
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The JSON value to update
|
|
|
[4mP[0m The paths to remove
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m,
|
|
|
[1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To remove elements of an array:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_remove[0m[37m[40m([0m[35m[40m'[1,2,3]'[0m[37m[40m, [0m[35m[40m'$[1]'[0m[37m[40m, [0m[35m[40m'$[1]'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To remove object properties:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_remove[0m[37m[40m([0m[35m[40m'{"a":1,"b":2}'[0m[37m[40m, [0m[35m[40m'$.b'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_replace[0m[4m([0m[4mX[0m[4m, [0m[4mP[0m[4m, [0m[4mY[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Replaces existing values in a JSON object/array at the given
|
|
|
locations
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The JSON value to update
|
|
|
[4mP[0m The path to replace
|
|
|
[4mY[0m The new value for the property
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m,
|
|
|
[1mjson_remove()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To replace an existing value:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_replace[0m[37m[40m([0m[35m[40m'{"a": 1}'[0m[37m[40m, [0m[35m[40m'$.a'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To replace a value without creating a new property:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_replace[0m[37m[40m([0m[35m[40m'{"a": 1}'[0m[37m[40m, [0m[35m[40m'$.a'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m, [0m[35m[40m'$.b'[0m[37m[40m, [0m[1m[37m[40m3[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_set[0m[4m([0m[4mX[0m[4m, [0m[4mP[0m[4m, [0m[4mY[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Inserts or replaces existing values in a JSON object/array at the
|
|
|
given locations
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The JSON value to update
|
|
|
[4mP[0m The path to the insertion point. A '#' array index means
|
|
|
append the value
|
|
|
[4mY[0m The value to set
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m,
|
|
|
[1mjson_remove()[0m, [1mjson_replace()[0m, [1mjson_tree()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To replace an existing array element:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_set[0m[37m[40m([0m[35m[40m'[1, 2]'[0m[37m[40m, [0m[35m[40m'$[1]'[0m[37m[40m, [0m[1m[37m[40m3[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To replace a value and create a new property:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_set[0m[37m[40m([0m[35m[40m'{"a": 1}'[0m[37m[40m, [0m[35m[40m'$.a'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m, [0m[35m[40m'$.b'[0m[37m[40m, [0m[1m[37m[40m3[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_tree[0m[4m([0m[4mX[0m[4m, [[0m[4mP[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
A table-valued-function that recursively descends through a JSON
|
|
|
value
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The JSON value to query
|
|
|
[4mP[0m The path to the value to query
|
|
|
[4mResults[0m
|
|
|
[4mkey[0m The array index for elements of an array or
|
|
|
property names of the object
|
|
|
[4mvalue[0m The value for the current element
|
|
|
[4mtype[0m The type of the current element
|
|
|
[4matom[0m The SQL value of the element, if it is a
|
|
|
primitive type
|
|
|
[4mfullkey[0m The path to the current element
|
|
|
[4mpath[0m The path to the container of this element
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m,
|
|
|
[1mjson_remove()[0m, [1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_type()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To iterate over an array:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[36m[40mkey[0m[37m[40m,[0m[37m[40mvalue[0m[37m[40m,[0m[37m[40mtype[0m[37m[40m,[0m[37m[40matom[0m[37m[40m,[0m[37m[40mfullkey[0m[37m[40m,[0m[37m[40mpath[0m[37m[40m [0m[1m[36m[40mFROM[0m
|
|
|
[37m[40m [0m[1m[37m[40mjson_tree[0m[37m[40m([0m[35m[40m'[null,1,"two",{"three":4.5}]'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_type[0m[4m([0m[4mX[0m[4m, [[0m[4mP[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the type of a JSON value
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The JSON value to query
|
|
|
[4mP[0m The path to the value
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m,
|
|
|
[1mjson_remove()[0m, [1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_valid()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the type of a value:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_type[0m[37m[40m([0m[35m[40m'[null,1,2.1,"three",{"four":5}]'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#2 To get the type of an array element:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_type[0m[37m[40m([0m[35m[40m'[null,1,2.1,"three",{"four":5}]'[0m[37m[40m, [0m[35m[40m'$[0]'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#3 To get the type of a string:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_type[0m[37m[40m([0m[35m[40m'[null,1,2.1,"three",{"four":5}]'[0m[37m[40m, [0m[35m[40m'$[3]'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjson_valid[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Tests if the given value is valid JSON
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The value to check
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m,
|
|
|
[1mjson_remove()[0m, [1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m,
|
|
|
[1myaml_to_json()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To check an empty string:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_valid[0m[37m[40m([0m[35m[40m''[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To check a string:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjson_valid[0m[37m[40m([0m[35m[40m'"a"'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mjulianday[0m[4m([0m[4mtimestring[0m[4m, [0m[4mmodifier[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the number of days since noon in Greenwich on November 24,
|
|
|
4714 B.C.
|
|
|
[4mParameters[0m
|
|
|
[4mtimestring[0m The string to convert to a date with
|
|
|
time.
|
|
|
[4mmodifier[0m A transformation that is applied to the
|
|
|
value to the left.
|
|
|
[4mSee Also[0m
|
|
|
[1mdate()[0m, [1mdatetime()[0m, [1mhumanize_duration()[0m, [1mstrftime()[0m, [1mtime()[0m,
|
|
|
[1mtimediff()[0m, [1mtimeslice()[0m, [1mtimezone()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the julian day from the timestamp '2017-01-02T03:04:05':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjulianday[0m[37m[40m([0m[35m[40m'2017-01-02T03:04:05'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the julian day from the timestamp '2017-01-02T03:04:05' plus one minute:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjulianday[0m[37m[40m([0m[35m[40m'2017-01-02T03:04:05'[0m[37m[40m, [0m[35m[40m'+1 minute'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#3 To get the julian day from the timestamp 1491341842:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mjulianday[0m[37m[40m([0m[1m[37m[40m1491341842[0m[37m[40m, [0m[35m[40m'unixepoch'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mlag[0m[4m([0m[4mexpr[0m[4m, [[0m[4moffset[0m[4m], [[0m[4mdefault[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the result of evaluating the expression against the
|
|
|
previous row in the partition.
|
|
|
[4mParameters[0m
|
|
|
[4mexpr[0m The expression to execute over the previous
|
|
|
row
|
|
|
[4moffset[0m The offset from the current row in the
|
|
|
partition
|
|
|
[4mdefault[0m The default value if the previous row does not
|
|
|
exist instead of NULL
|
|
|
[4mSee Also[0m
|
|
|
[1mcume_dist()[0m, [1mdense_rank()[0m, [1mfirst_value()[0m, [1mlast_value()[0m, [1mlead()[0m,
|
|
|
[1mnth_value()[0m, [1mntile()[0m, [1mpercent_rank()[0m, [1mrank()[0m, [1mrow_number()[0m
|
|
|
|
|
|
[1m[4mlast_insert_rowid[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the ROWID of the last row insert from the database
|
|
|
connection which invoked the function
|
|
|
|
|
|
|
|
|
[1m[4mlast_value[0m[4m([0m[4mexpr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the result of evaluating the expression against the last
|
|
|
row in the window frame.
|
|
|
[4mParameter[0m
|
|
|
[4mexpr[0m The expression to execute over the last row
|
|
|
[4mSee Also[0m
|
|
|
[1mcume_dist()[0m, [1mdense_rank()[0m, [1mfirst_value()[0m, [1mlag()[0m, [1mlead()[0m, [1mnth_value()[0m,
|
|
|
[1mntile()[0m, [1mpercent_rank()[0m, [1mrank()[0m, [1mrow_number()[0m
|
|
|
|
|
|
[1m[4mlead[0m[4m([0m[4mexpr[0m[4m, [[0m[4moffset[0m[4m], [[0m[4mdefault[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the result of evaluating the expression against the next
|
|
|
row in the partition.
|
|
|
[4mParameters[0m
|
|
|
[4mexpr[0m The expression to execute over the next row
|
|
|
[4moffset[0m The offset from the current row in the
|
|
|
partition
|
|
|
[4mdefault[0m The default value if the next row does not
|
|
|
exist instead of NULL
|
|
|
[4mSee Also[0m
|
|
|
[1mcume_dist()[0m, [1mdense_rank()[0m, [1mfirst_value()[0m, [1mlag()[0m, [1mlast_value()[0m,
|
|
|
[1mnth_value()[0m, [1mntile()[0m, [1mpercent_rank()[0m, [1mrank()[0m, [1mrow_number()[0m
|
|
|
|
|
|
[1m[4mleftstr[0m[4m([0m[4mstr[0m[4m, [0m[4mN[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the N leftmost (UTF-8) characters in the given string.
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to return subset.
|
|
|
[4mN[0m The number of characters from the left side of the
|
|
|
string to return.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mlength()[0m,
|
|
|
[1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the first character of the string 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mleftstr[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the first ten characters of a string, regardless of size:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mleftstr[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m10[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mlength[0m[4m([0m[4mstr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the number of characters (not bytes) in the given string
|
|
|
prior to the first NUL character
|
|
|
[4mParameter[0m
|
|
|
[4mstr[0m The string to determine the length of
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the length of the string 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mlength[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mlike[0m[4m([0m[4mpattern[0m[4m, [0m[4mstr[0m[4m, [[0m[4mescape[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Match a string against a pattern
|
|
|
[4mParameters[0m
|
|
|
[4mpattern[0m The pattern to match. A percent symbol (%)
|
|
|
will match zero or more characters and an underscore (_)
|
|
|
will match a single character.
|
|
|
[4mstr[0m The string to match
|
|
|
[4mescape[0m The escape character that can be used to
|
|
|
prefix a literal percent or underscore in the pattern.
|
|
|
|
|
|
[4mExamples[0m
|
|
|
#1 To test if the string 'aabcc' contains the letter 'b':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[36m[40mlike[0m[37m[40m([0m[35m[40m'%b%'[0m[37m[40m, [0m[35m[40m'aabcc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To test if the string 'aab%' ends with 'b%':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[36m[40mlike[0m[37m[40m([0m[35m[40m'%b:%'[0m[37m[40m, [0m[35m[40m'aab%'[0m[37m[40m, [0m[35m[40m':'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mlikelihood[0m[4m([0m[4mvalue[0m[4m, [0m[4mprobability[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Provides a hint to the query planner that the first argument is a
|
|
|
boolean that is true with the given probability
|
|
|
[4mParameters[0m
|
|
|
[4mvalue[0m The boolean value to return
|
|
|
[4mprobability[0m A floating point constant between 0.0
|
|
|
and 1.0
|
|
|
|
|
|
|
|
|
[1m[4mlikely[0m[4m([0m[4mvalue[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Short-hand for likelihood(X,0.9375)
|
|
|
[4mParameter[0m
|
|
|
[4mvalue[0m The boolean value to return
|
|
|
|
|
|
|
|
|
[1m[4mlnav_top_file[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Return the name of the file that the top line in the current view
|
|
|
came from.
|
|
|
|
|
|
|
|
|
[1m[4mlnav_version[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Return the current version of lnav
|
|
|
|
|
|
|
|
|
[1m[4mload_extension[0m[4m([0m[4mpath[0m[4m, [[0m[4mentry-point[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Loads SQLite extensions out of the given shared library file using
|
|
|
the given entry point.
|
|
|
[4mParameters[0m
|
|
|
[4mpath[0m The path to the shared library
|
|
|
containing the extension.
|
|
|
[4mentry-point[0m
|
|
|
|
|
|
|
|
|
[1m[4mlog[0m[4m([0m[4mx[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the natural logarithm of x
|
|
|
[4mParameter[0m
|
|
|
[4mx[0m The number
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog10()[0m, [1mmax()[0m,
|
|
|
[1mmin()[0m, [1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the natual logarithm of 8:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mlog[0m[37m[40m([0m[1m[37m[40m8[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mlog10[0m[4m([0m[4mx[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the base-10 logarithm of X
|
|
|
[4mParameter[0m
|
|
|
[4mx[0m The number
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mmax()[0m, [1mmin()[0m,
|
|
|
[1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the logarithm of 100:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mlog10[0m[37m[40m([0m[1m[37m[40m100[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mlog_msg_line[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Return the starting line number of the focused log message.
|
|
|
|
|
|
|
|
|
[1m[4mlog_top_datetime[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Return the timestamp of the line at the top of the log view.
|
|
|
|
|
|
|
|
|
[1m[4mlog_top_line[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Return the number of the focused line of the log view.
|
|
|
|
|
|
|
|
|
[1m[4mlogfmt2json[0m[4m([0m[4mstr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Convert a logfmt-encoded string into JSON
|
|
|
[4mParameter[0m
|
|
|
[4mstr[0m The logfmt message to parse
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To extract key/value pairs from a log message:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mlogfmt2json[0m[37m[40m([0m[35m[40m'foo=1 bar=2 name="Rolo Tomassi"'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mlower[0m[4m([0m[4mstr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a copy of the given string with all ASCII characters
|
|
|
converted to lower case.
|
|
|
[4mParameter[0m
|
|
|
[4mstr[0m The string to convert.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To lowercase the string 'AbC':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mlower[0m[37m[40m([0m[35m[40m'AbC'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mltrim[0m[4m([0m[4mstr[0m[4m, [[0m[4mchars[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a string formed by removing any and all characters that
|
|
|
appear in the second argument from the left side of the first.
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to trim characters from the left side
|
|
|
[4mchars[0m The characters to trim. Defaults to spaces.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To trim the leading space characters from the string ' abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mltrim[0m[37m[40m([0m[35m[40m' abc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To trim the characters 'a' or 'b' from the left side of the string 'aaaabbbc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mltrim[0m[37m[40m([0m[35m[40m'aaaabbbc'[0m[37m[40m, [0m[35m[40m'ab'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mmax[0m[4m([0m[4mX[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the argument with the maximum value, or return NULL if any
|
|
|
argument is NULL.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The numbers to find the maximum of. If only one argument
|
|
|
is given, this function operates as an aggregate.
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m,
|
|
|
[1mmin()[0m, [1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the largest value from the parameters:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mmax[0m[37m[40m([0m[1m[37m[40m2[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m, [0m[1m[37m[40m3[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the largest value from an aggregate:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mmax[0m[37m[40m([0m[37m[40mstatus[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mhttp_status_codes[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mmin[0m[4m([0m[4mX[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the argument with the minimum value, or return NULL if any
|
|
|
argument is NULL.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The numbers to find the minimum of. If only one argument
|
|
|
is given, this function operates as an aggregate.
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m,
|
|
|
[1mmax()[0m, [1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the smallest value from the parameters:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mmin[0m[37m[40m([0m[1m[37m[40m2[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m, [0m[1m[37m[40m3[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the smallest value from an aggregate:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mmin[0m[37m[40m([0m[37m[40mstatus[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mhttp_status_codes[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mnth_value[0m[4m([0m[4mexpr[0m[4m, [0m[4mN[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the result of evaluating the expression against the nth
|
|
|
row in the window frame.
|
|
|
[4mParameters[0m
|
|
|
[4mexpr[0m The expression to execute over the nth row
|
|
|
[4mN[0m The row number
|
|
|
[4mSee Also[0m
|
|
|
[1mcume_dist()[0m, [1mdense_rank()[0m, [1mfirst_value()[0m, [1mlag()[0m, [1mlast_value()[0m, [1mlead()[0m,
|
|
|
[1mntile()[0m, [1mpercent_rank()[0m, [1mrank()[0m, [1mrow_number()[0m
|
|
|
|
|
|
[1m[4mntile[0m[4m([0m[4mgroups[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the number of the group that the current row is a part of
|
|
|
[4mParameter[0m
|
|
|
[4mgroups[0m The number of groups
|
|
|
[4mSee Also[0m
|
|
|
[1mcume_dist()[0m, [1mdense_rank()[0m, [1mfirst_value()[0m, [1mlag()[0m, [1mlast_value()[0m, [1mlead()[0m,
|
|
|
[1mnth_value()[0m, [1mpercent_rank()[0m, [1mrank()[0m, [1mrow_number()[0m
|
|
|
|
|
|
[1m[4mnullif[0m[4m([0m[4mX[0m[4m, [0m[4mY[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns its first argument if the arguments are different and NULL
|
|
|
if the arguments are the same.
|
|
|
[4mParameters[0m
|
|
|
[4mX[0m The first argument to compare.
|
|
|
[4mY[0m The argument to compare against the first.
|
|
|
|
|
|
[4mExamples[0m
|
|
|
#1 To test if 1 is different from 1:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mnullif[0m[37m[40m([0m[1m[37m[40m1[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To test if 1 is different from 2:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mnullif[0m[37m[40m([0m[1m[37m[40m1[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mpadc[0m[4m([0m[4mstr[0m[4m, [0m[4mlen[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Pad the given string with enough spaces to make it centered within
|
|
|
the given length
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to pad
|
|
|
[4mlen[0m The minimum desired length of the output string
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To pad the string 'abc' to a length of six characters:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mpadc[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m6[0m[37m[40m) [0m[1m[37m[40m||[0m[37m[40m [0m[35m[40m'def'[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
#2 To pad the string 'abcdef' to a length of eight characters:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mpadc[0m[37m[40m([0m[35m[40m'abcdef'[0m[37m[40m, [0m[1m[37m[40m8[0m[37m[40m) [0m[1m[37m[40m||[0m[37m[40m [0m[35m[40m'ghi'[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mpadl[0m[4m([0m[4mstr[0m[4m, [0m[4mlen[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Pad the given string with leading spaces until it reaches the
|
|
|
desired length
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to pad
|
|
|
[4mlen[0m The minimum desired length of the output string
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadr()[0m, [1mparse_url()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To pad the string 'abc' to a length of six characters:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mpadl[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m6[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To pad the string 'abcdef' to a length of four characters:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mpadl[0m[37m[40m([0m[35m[40m'abcdef'[0m[37m[40m, [0m[1m[37m[40m4[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mpadr[0m[4m([0m[4mstr[0m[4m, [0m[4mlen[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Pad the given string with trailing spaces until it reaches the
|
|
|
desired length
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to pad
|
|
|
[4mlen[0m The minimum desired length of the output string
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mparse_url()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To pad the string 'abc' to a length of six characters:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mpadr[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m6[0m[37m[40m) [0m[1m[37m[40m||[0m[37m[40m [0m[35m[40m'def'[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
#2 To pad the string 'abcdef' to a length of four characters:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mpadr[0m[37m[40m([0m[35m[40m'abcdef'[0m[37m[40m, [0m[1m[37m[40m4[0m[37m[40m) [0m[1m[37m[40m||[0m[37m[40m [0m[35m[40m'ghi'[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mparse_url[0m[4m([0m[4murl[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Parse a URL and return the components in a JSON object.
|
|
|
Limitations: not all URL schemes are supported and repeated query
|
|
|
parameters are not captured.
|
|
|
[4mParameter[0m
|
|
|
[4murl[0m The URL to parse
|
|
|
[4mResults[0m
|
|
|
[4mscheme[0m The URL's scheme
|
|
|
[4musername[0m The name of the user specified in the
|
|
|
URL
|
|
|
[4mpassword[0m The password specified in the URL
|
|
|
[4mhost[0m The host name / IP specified in the URL
|
|
|
[4mport[0m The port specified in the URL
|
|
|
[4mpath[0m The path specified in the URL
|
|
|
[4mquery[0m The query string in the URL
|
|
|
[4mparameters[0m An object containing the query
|
|
|
parameters
|
|
|
[4mfragment[0m The fragment specified in the URL
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To parse the URL 'https://example.com/search?q=hello%20world':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mparse_url[0m[37m[40m([0m[35m[40m'https://example.com/search?q=hello%20world'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#2 To parse the URL 'https://alice@[fe80::14ff:4ee5:1215:2fb2]':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mparse_url[0m[37m[40m([0m[35m[40m'https://alice@[fe80::14ff:4ee5:1215:2fb2]'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mpercent_rank[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns (rank - 1) / (partition-rows - 1)
|
|
|
[4mSee Also[0m
|
|
|
[1mcume_dist()[0m, [1mdense_rank()[0m, [1mfirst_value()[0m, [1mlag()[0m, [1mlast_value()[0m, [1mlead()[0m,
|
|
|
[1mnth_value()[0m, [1mntile()[0m, [1mrank()[0m, [1mrow_number()[0m
|
|
|
|
|
|
[1m[4mpi[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the value of PI
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m,
|
|
|
[1mmax()[0m, [1mmin()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the value of PI:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mpi[0m[37m[40m() [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mpower[0m[4m([0m[4mbase[0m[4m, [0m[4mexp[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the base to the given exponent
|
|
|
[4mParameters[0m
|
|
|
[4mbase[0m The base number
|
|
|
[4mexp[0m The exponent
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m,
|
|
|
[1mmax()[0m, [1mmin()[0m, [1mpi()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To raise two to the power of three:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mpower[0m[37m[40m([0m[1m[37m[40m2[0m[37m[40m, [0m[1m[37m[40m3[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mprintf[0m[4m([0m[4mformat[0m[4m, [0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a string with this functions arguments substituted into
|
|
|
the given format. Substitution points are specified using percent
|
|
|
(%) options, much like the standard C printf() function.
|
|
|
[4mParameters[0m
|
|
|
[4mformat[0m The format of the string to return.
|
|
|
[4mX[0m The argument to substitute at a given position
|
|
|
in the format.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To substitute 'World' into the string 'Hello, %s!':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mprintf[0m[37m[40m([0m[35m[40m'Hello, %s!'[0m[37m[40m, [0m[35m[40m'World'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To right-align 'small' in the string 'align:' with a column width of 10:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mprintf[0m[37m[40m([0m[35m[40m'align: % 10s'[0m[37m[40m, [0m[35m[40m'small'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To format 11 with a width of five characters and leading zeroes:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mprintf[0m[37m[40m([0m[35m[40m'value: %05d'[0m[37m[40m, [0m[1m[37m[40m11[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mproper[0m[4m([0m[4mstr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Capitalize the first character of words in the given string
|
|
|
[4mParameter[0m
|
|
|
[4mstr[0m The string to capitalize.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To capitalize the words in the string 'hello, world!':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mproper[0m[37m[40m([0m[35m[40m'hello, world!'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mquote[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the text of an SQL literal which is the value of its
|
|
|
argument suitable for inclusion into an SQL statement.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The string to quote.
|
|
|
|
|
|
[4mExamples[0m
|
|
|
#1 To quote the string 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mquote[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To quote the string 'abc'123':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mquote[0m[37m[40m([0m[35m[40m'abc''123'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mradians[0m[4m([0m[4mdegrees[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Converts degrees to radians
|
|
|
[4mParameter[0m
|
|
|
[4mdegrees[0m The degrees value to convert to radians
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m,
|
|
|
[1mmax()[0m, [1mmin()[0m, [1mpi()[0m, [1mpower()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m, [1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To convert 180 degrees to radians:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mradians[0m[37m[40m([0m[1m[37m[40m180[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mraise_error[0m[4m([0m[4mmsg[0m[4m, [[0m[4mreason[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Raises an error with the given message when executed
|
|
|
[4mParameters[0m
|
|
|
[4mmsg[0m The error message
|
|
|
[4mreason[0m The reason the error occurred
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To raise an error if a variable is not set:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mifnull[0m[37m[40m([0m[37m[40m$val[0m[37m[40m, [0m[1m[37m[40mraise_error[0m[37m[40m([0m[35m[40m'please set $val'[0m[37m[40m, [0m[35m[40m'because'[0m[37m[40m))[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mrandom[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a pseudo-random integer between -9223372036854775808 and
|
|
|
+9223372036854775807.
|
|
|
|
|
|
|
|
|
[1m[4mrandomblob[0m[4m([0m[4mN[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Return an N-byte blob containing pseudo-random bytes.
|
|
|
[4mParameter[0m
|
|
|
[4mN[0m The size of the blob in bytes.
|
|
|
|
|
|
|
|
|
[1m[4mrank[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the row_number() of the first peer in each group with gaps
|
|
|
[4mSee Also[0m
|
|
|
[1mcume_dist()[0m, [1mdense_rank()[0m, [1mfirst_value()[0m, [1mlag()[0m, [1mlast_value()[0m, [1mlead()[0m,
|
|
|
[1mnth_value()[0m, [1mntile()[0m, [1mpercent_rank()[0m, [1mrow_number()[0m
|
|
|
|
|
|
[1m[4mreadlink[0m[4m([0m[4mpath[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Read the target of a symbolic link.
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m The path to the symbolic link.
|
|
|
[4mSee Also[0m
|
|
|
[1mbasename()[0m, [1mdirname()[0m, [1mjoinpath()[0m, [1mrealpath()[0m
|
|
|
|
|
|
[1m[4mrealpath[0m[4m([0m[4mpath[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the resolved version of the given path, expanding symbolic
|
|
|
links and resolving '.' and '..' references.
|
|
|
[4mParameter[0m
|
|
|
[4mpath[0m The path to resolve.
|
|
|
[4mSee Also[0m
|
|
|
[1mbasename()[0m, [1mdirname()[0m, [1mjoinpath()[0m, [1mreadlink()[0m
|
|
|
|
|
|
[1m[4mregexp[0m[4m([0m[4mre[0m[4m, [0m[4mstr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Test if a string matches a regular expression
|
|
|
[4mParameters[0m
|
|
|
[4mre[0m The regular expression to use
|
|
|
[4mstr[0m The string to test against the regular expression
|
|
|
|
|
|
|
|
|
[1m[4mregexp_capture[0m[4m([0m[4mstring[0m[4m, [0m[4mpattern[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
A table-valued function that executes a regular-expression over a
|
|
|
string and returns the captured values. If the regex only matches a
|
|
|
subset of the input string, it will be rerun on the remaining parts
|
|
|
of the string until no more matches are found.
|
|
|
[4mParameters[0m
|
|
|
[4mstring[0m The string to match against the given pattern.
|
|
|
[4mpattern[0m The regular expression to match.
|
|
|
[4mResults[0m
|
|
|
[4mmatch_index[0m The match iteration. This value
|
|
|
will increase each time a new match is found in the
|
|
|
input string.
|
|
|
[4mcapture_index[0m The index of the capture in the
|
|
|
regex.
|
|
|
[4mcapture_name[0m The name of the capture in the
|
|
|
regex.
|
|
|
[4mcapture_count[0m The total number of captures in
|
|
|
the regex.
|
|
|
[4mrange_start[0m The start of the capture in the
|
|
|
input string.
|
|
|
[4mrange_stop[0m The stop of the capture in the
|
|
|
input string.
|
|
|
[4mcontent[0m The captured value from the
|
|
|
string.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m,
|
|
|
[1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To extract the key/value pairs 'a'/1 and 'b'/2 from the string 'a=1; b=2':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[1m[37m[40mregexp_capture[0m[37m[40m([0m[35m[40m'a=1; b=2'[0m[37m[40m, [0m[35m[40m'(\w+)=(\d+)'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mregexp_capture_into_json[0m[4m([0m[4mstring[0m[4m, [0m[4mpattern[0m[4m, [[0m[4moptions[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
A table-valued function that executes a regular-expression over a
|
|
|
string and returns the captured values as a JSON object. If the
|
|
|
regex only matches a subset of the input string, it will be rerun on
|
|
|
the remaining parts of the string until no more matches are found.
|
|
|
[4mParameters[0m
|
|
|
[4mstring[0m The string to match against the given pattern.
|
|
|
[4mpattern[0m The regular expression to match.
|
|
|
[4moptions[0m A JSON object with the following option:
|
|
|
convert-numbers - True (default) if text that looks like
|
|
|
numeric data should be converted to JSON numbers, false if
|
|
|
they should be captured as strings.
|
|
|
[4mResults[0m
|
|
|
[4mmatch_index[0m The match iteration. This value will
|
|
|
increase each time a new match is found in the input
|
|
|
string.
|
|
|
[4mcontent[0m The captured values from the string.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_match()[0m,
|
|
|
[1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m,
|
|
|
[1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m,
|
|
|
[1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m, [1mupper()[0m,
|
|
|
[1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To extract the key/value pairs 'a'/1 and 'b'/2 from the string 'a=1; b=2':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[1m[37m[40mregexp_capture_into_json[0m[37m[40m([0m[35m[40m'a=1; b=2'[0m[37m[40m, [0m[35m[40m'(\w+)=(\d+)'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mregexp_match[0m[4m([0m[4mre[0m[4m, [0m[4mstr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Match a string against a regular expression and return the capture
|
|
|
groups as JSON.
|
|
|
[4mParameters[0m
|
|
|
[4mre[0m The regular expression to use
|
|
|
[4mstr[0m The string to test against the regular expression
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_replace()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To capture the digits from the string '123':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mregexp_match[0m[37m[40m([0m[35m[40m'(\d+)'[0m[37m[40m, [0m[35m[40m'123'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To capture a number and word into a JSON object with the properties 'col_0' and
|
|
|
'col_1':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mregexp_match[0m[37m[40m([0m[35m[40m'(\d+) (\w+)'[0m[37m[40m, [0m[35m[40m'123 four'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To capture a number and word into a JSON object with the named properties 'num' and
|
|
|
'str':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mregexp_match[0m[37m[40m([0m[35m[40m'(?<num>\d+) (?<str>\w+)'[0m[37m[40m, [0m[35m[40m'123 four'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mregexp_replace[0m[4m([0m[4mstr[0m[4m, [0m[4mre[0m[4m, [0m[4mrepl[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Replace the parts of a string that match a regular expression.
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to perform replacements on
|
|
|
[4mre[0m The regular expression to match
|
|
|
[4mrepl[0m The replacement string. You can reference capture
|
|
|
groups with a backslash followed by the number of the group,
|
|
|
starting with 1.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_match()[0m, [1mreplace()[0m,
|
|
|
[1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To replace the word at the start of the string 'Hello, World!' with 'Goodbye':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mregexp_replace[0m[37m[40m([0m[35m[40m'Hello, World!'[0m[37m[40m, [0m[35m[40m'^(\w+)'[0m[37m[40m, [0m[35m[40m'Goodbye'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#2 To wrap alphanumeric words with angle brackets:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mregexp_replace[0m[37m[40m([0m[35m[40m'123 abc'[0m[37m[40m, [0m[35m[40m'(\w+)'[0m[37m[40m, [0m[35m[40m'<\1>'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mreplace[0m[4m([0m[4mstr[0m[4m, [0m[4mold[0m[4m, [0m[4mreplacement[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a string formed by substituting the replacement string for
|
|
|
every occurrence of the old string in the given string.
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to perform substitutions
|
|
|
on.
|
|
|
[4mold[0m The string to be replaced.
|
|
|
[4mreplacement[0m The string to replace any occurrences
|
|
|
of the old string with.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To replace the string 'x' with 'z' in 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[36m[40mreplace[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[35m[40m'x'[0m[37m[40m, [0m[35m[40m'z'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To replace the string 'a' with 'z' in 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[36m[40mreplace[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[35m[40m'a'[0m[37m[40m, [0m[35m[40m'z'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mreplicate[0m[4m([0m[4mstr[0m[4m, [0m[4mN[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the given string concatenated N times.
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to replicate.
|
|
|
[4mN[0m The number of times to replicate the string.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m,
|
|
|
[1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m,
|
|
|
[1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To repeat the string 'abc' three times:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mreplicate[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m3[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mreverse[0m[4m([0m[4mstr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the reverse of the given string.
|
|
|
[4mParameter[0m
|
|
|
[4mstr[0m The string to reverse.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To reverse the string 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mreverse[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mrightstr[0m[4m([0m[4mstr[0m[4m, [0m[4mN[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the N rightmost (UTF-8) characters in the given string.
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to return subset.
|
|
|
[4mN[0m The number of characters from the right side of the
|
|
|
string to return.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m,
|
|
|
[1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m,
|
|
|
[1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the last character of the string 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mrightstr[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the last ten characters of a string, regardless of size:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mrightstr[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m10[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mround[0m[4m([0m[4mnum[0m[4m, [[0m[4mdigits[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a floating-point value rounded to the given number of
|
|
|
digits to the right of the decimal point.
|
|
|
[4mParameters[0m
|
|
|
[4mnum[0m The value to round.
|
|
|
[4mdigits[0m The number of digits to the right of the decimal
|
|
|
to round to.
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m,
|
|
|
[1mmax()[0m, [1mmin()[0m, [1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1msign()[0m, [1msquare()[0m, [1msum()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To round the number 123.456 to an integer:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mround[0m[37m[40m([0m[1m[37m[40m123.456[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To round the number 123.456 to a precision of 1:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mround[0m[37m[40m([0m[1m[37m[40m123.456[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To round the number 123.456 to a precision of 5:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mround[0m[37m[40m([0m[1m[37m[40m123.456[0m[37m[40m, [0m[1m[37m[40m5[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mrow_number[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the number of the row within the current partition,
|
|
|
starting from 1.
|
|
|
[4mSee Also[0m
|
|
|
[1mcume_dist()[0m, [1mdense_rank()[0m, [1mfirst_value()[0m, [1mlag()[0m, [1mlast_value()[0m, [1mlead()[0m,
|
|
|
[1mnth_value()[0m, [1mntile()[0m, [1mpercent_rank()[0m, [1mrank()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To number messages from a process:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mrow_number[0m[37m[40m() [0m[1m[36m[40mOVER[0m[37m[40m ([0m[1m[36m[40mPARTITION[0m[37m[40m [0m[1m[36m[40mBY[0m[37m[40m [0m[37m[40mex_procname[0m[37m[40m [0m[1m[36m[40mORDER[0m[37m[40m [0m[1m[36m[40mBY[0m[37m[40m [0m[37m[40mlog_line[0m[37m[40m) [0m[1m[36m[40mAS[0m[37m[40m [0m[37m[40mmsg_num[0m[37m[40m,[0m
|
|
|
[37m[40m [0m[37m[40mex_procname[0m[37m[40m, [0m[37m[40mlog_body[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mrtrim[0m[4m([0m[4mstr[0m[4m, [[0m[4mchars[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a string formed by removing any and all characters that
|
|
|
appear in the second argument from the right side of the first.
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to trim characters from the right side
|
|
|
[4mchars[0m The characters to trim. Defaults to spaces.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To trim the space characters from the end of the string 'abc ':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mrtrim[0m[37m[40m([0m[35m[40m'abc '[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To trim the characters 'b' and 'c' from the string 'abbbbcccc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mrtrim[0m[37m[40m([0m[35m[40m'abbbbcccc'[0m[37m[40m, [0m[35m[40m'bc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mshell_exec[0m[4m([0m[4mcmd[0m[4m, [[0m[4minput[0m[4m], [[0m[4moptions[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Executes a shell command and returns its output.
|
|
|
[4mParameters[0m
|
|
|
[4mcmd[0m The command to execute.
|
|
|
[4minput[0m A blob of data to write to the command's
|
|
|
standard input.
|
|
|
[4moptions[0m A JSON object containing options for the
|
|
|
execution with the following properties:
|
|
|
[4menv[0m - An object containing the environment
|
|
|
variables to set or, if NULL, to unset.
|
|
|
[4mSee Also[0m
|
|
|
|
|
|
|
|
|
[1m[4msign[0m[4m([0m[4mnum[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the sign of the given number as -1, 0, or 1
|
|
|
[4mParameter[0m
|
|
|
[4mnum[0m The number
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m,
|
|
|
[1mmax()[0m, [1mmin()[0m, [1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msquare()[0m, [1msum()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the sign of 10:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msign[0m[37m[40m([0m[1m[37m[40m10[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the sign of 0:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msign[0m[37m[40m([0m[1m[37m[40m0[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To get the sign of -10:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msign[0m[37m[40m([0m[1m[37m[40m-10[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4msparkline[0m[4m([0m[4mvalue[0m[4m, [[0m[4mupper[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Function used to generate a sparkline bar chart. The
|
|
|
non-aggregate version converts a single numeric value on a range to
|
|
|
a bar chart character. The aggregate version returns a string with
|
|
|
a bar character for every numeric input
|
|
|
[4mParameters[0m
|
|
|
[4mvalue[0m The numeric value to convert
|
|
|
[4mupper[0m The upper bound of the numeric range. The
|
|
|
non-aggregate version defaults to 100. The aggregate
|
|
|
version uses the largest value in the inputs.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1mspooky_hash()[0m,
|
|
|
[1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m,
|
|
|
[1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the unicode block element for the value 32 in the range of 0-128:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msparkline[0m[37m[40m([0m[1m[37m[40m32[0m[37m[40m, [0m[1m[37m[40m128[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To chart the values in a JSON array:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msparkline[0m[37m[40m([0m[37m[40mvalue[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[1m[37m[40mjson_each[0m[37m[40m([0m[35m[40m'[0, 1, 2, 3, 4, 5, 6, 7, 8]'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mspooky_hash[0m[4m([0m[4mstr[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Compute the hash value for the given arguments.
|
|
|
[4mParameter[0m
|
|
|
[4mstr[0m The string to hash
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m,
|
|
|
[1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To produce a hash for the string 'Hello, World!':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mspooky_hash[0m[37m[40m([0m[35m[40m'Hello, World!'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To produce a hash for the parameters where one is NULL:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mspooky_hash[0m[37m[40m([0m[35m[40m'Hello, World!'[0m[37m[40m, [0m[1m[36m[40mNULL[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To produce a hash for the parameters where one is an empty string:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mspooky_hash[0m[37m[40m([0m[35m[40m'Hello, World!'[0m[37m[40m, [0m[35m[40m''[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#4 To produce a hash for the parameters where one is a number:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mspooky_hash[0m[37m[40m([0m[35m[40m'Hello, World!'[0m[37m[40m, [0m[1m[37m[40m123[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4msqlite_compileoption_get[0m[4m([0m[4mN[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the N-th compile-time option used to build SQLite or NULL
|
|
|
if N is out of range.
|
|
|
[4mParameter[0m
|
|
|
[4mN[0m The option number to get
|
|
|
|
|
|
|
|
|
[1m[4msqlite_compileoption_used[0m[4m([0m[4moption[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns true (1) or false (0) depending on whether or not that
|
|
|
compile-time option was used during the build.
|
|
|
[4mParameter[0m
|
|
|
[4moption[0m The name of the compile-time option.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To check if the SQLite library was compiled with ENABLE_FTS3:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msqlite_compileoption_used[0m[37m[40m([0m[35m[40m'ENABLE_FTS3'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4msqlite_source_id[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a string that identifies the specific version of the
|
|
|
source code that was used to build the SQLite library.
|
|
|
|
|
|
|
|
|
[1m[4msqlite_version[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the version string for the SQLite library that is running.
|
|
|
|
|
|
|
|
|
[1m[4msquare[0m[4m([0m[4mnum[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the square of the argument
|
|
|
[4mParameter[0m
|
|
|
[4mnum[0m The number to square
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m,
|
|
|
[1mmax()[0m, [1mmin()[0m, [1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msum()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the square of two:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msquare[0m[37m[40m([0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mstartswith[0m[4m([0m[4mstr[0m[4m, [0m[4mprefix[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Test if a string begins with the given prefix
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to test
|
|
|
[4mprefix[0m The prefix to check in the string
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m,
|
|
|
[1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To test if the string 'foobar' starts with 'foo':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mstartswith[0m[37m[40m([0m[35m[40m'foobar'[0m[37m[40m, [0m[35m[40m'foo'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To test if the string 'foobar' starts with 'bar':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mstartswith[0m[37m[40m([0m[35m[40m'foobar'[0m[37m[40m, [0m[35m[40m'bar'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mstrfilter[0m[4m([0m[4msource[0m[4m, [0m[4minclude[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the source string with only the characters given in the
|
|
|
second parameter
|
|
|
[4mParameters[0m
|
|
|
[4msource[0m The string to filter
|
|
|
[4minclude[0m The characters to include in the result
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m, [1municode()[0m,
|
|
|
[1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the 'b', 'c', and 'd' characters from the string 'abcabc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mstrfilter[0m[37m[40m([0m[35m[40m'abcabc'[0m[37m[40m, [0m[35m[40m'bcd'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mstrftime[0m[4m([0m[4mformat[0m[4m, [0m[4mtimestring[0m[4m, [0m[4mmodifier[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the date formatted according to the format string
|
|
|
specified as the first argument.
|
|
|
[4mParameters[0m
|
|
|
[4mformat[0m A format string with substitutions
|
|
|
similar to those found in the strftime() standard C
|
|
|
library.
|
|
|
[4mtimestring[0m The string to convert to a date with
|
|
|
time.
|
|
|
[4mmodifier[0m A transformation that is applied to the
|
|
|
value to the left.
|
|
|
[4mSee Also[0m
|
|
|
[1mdate()[0m, [1mdatetime()[0m, [1mhumanize_duration()[0m, [1mjulianday()[0m, [1mtime()[0m,
|
|
|
[1mtimediff()[0m, [1mtimeslice()[0m, [1mtimezone()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the year from the timestamp '2017-01-02T03:04:05':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mstrftime[0m[37m[40m([0m[35m[40m'%Y'[0m[37m[40m, [0m[35m[40m'2017-01-02T03:04:05'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To create a string with the time from the timestamp '2017-01-02T03:04:05' plus one
|
|
|
minute:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mstrftime[0m[37m[40m([0m[35m[40m'The time is: %H:%M:%S'[0m[37m[40m, [0m[35m[40m'2017-01-02T03:04:05'[0m[37m[40m, [0m[35m[40m'+1 minute'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#3 To create a string with the Julian day from the epoch timestamp 1491341842:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mstrftime[0m[37m[40m([0m[35m[40m'Julian day: %J'[0m[37m[40m, [0m[1m[37m[40m1491341842[0m[37m[40m, [0m[35m[40m'unixepoch'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4msubstr[0m[4m([0m[4mstr[0m[4m, [0m[4mstart[0m[4m, [[0m[4msize[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a substring of input string X that begins with the Y-th
|
|
|
character and which is Z characters long.
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to extract a substring from.
|
|
|
[4mstart[0m The index within 'str' that is the start of the
|
|
|
substring. Indexes begin at 1. A negative value means that
|
|
|
the substring is found by counting from the right rather
|
|
|
than the left.
|
|
|
[4msize[0m The size of the substring. If not given, then all
|
|
|
characters through the end of the string are returned. If
|
|
|
the value is negative, then the characters before the start
|
|
|
are returned.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the substring starting at the second character until the end of the string
|
|
|
'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msubstr[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the substring of size one starting at the second character of the string
|
|
|
'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msubstr[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m2[0m[37m[40m, [0m[1m[37m[40m1[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To get the substring starting at the last character until the end of the string
|
|
|
'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msubstr[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m-1[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#4 To get the substring starting at the last character and going backwards one step of
|
|
|
the string 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msubstr[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m, [0m[1m[37m[40m-1[0m[37m[40m, [0m[1m[37m[40m-1[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4msum[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the sum of the values in the group as an integer.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The values to add.
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m,
|
|
|
[1mmax()[0m, [1mmin()[0m, [1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m,
|
|
|
[1mtotal()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To sum all of the values in the column 'ex_duration' from the table
|
|
|
'lnav_example_log':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40msum[0m[37m[40m([0m[37m[40mex_duration[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mtime[0m[4m([0m[4mtimestring[0m[4m, [0m[4mmodifier[0m[4m, ...)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the time in this format: HH:MM:SS.
|
|
|
[4mParameters[0m
|
|
|
[4mtimestring[0m The string to convert to a time.
|
|
|
[4mmodifier[0m A transformation that is applied to the
|
|
|
value to the left.
|
|
|
[4mSee Also[0m
|
|
|
[1mdate()[0m, [1mdatetime()[0m, [1mhumanize_duration()[0m, [1mjulianday()[0m, [1mstrftime()[0m,
|
|
|
[1mtimediff()[0m, [1mtimeslice()[0m, [1mtimezone()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the time portion of the timestamp '2017-01-02T03:04:05':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtime[0m[37m[40m([0m[35m[40m'2017-01-02T03:04:05'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the time portion of the timestamp '2017-01-02T03:04:05' plus one minute:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtime[0m[37m[40m([0m[35m[40m'2017-01-02T03:04:05'[0m[37m[40m, [0m[35m[40m'+1 minute'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#3 To get the time portion of the epoch timestamp 1491341842:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtime[0m[37m[40m([0m[1m[37m[40m1491341842[0m[37m[40m, [0m[35m[40m'unixepoch'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mtimediff[0m[4m([0m[4mtime1[0m[4m, [0m[4mtime2[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Compute the difference between two timestamps in seconds
|
|
|
[4mParameters[0m
|
|
|
[4mtime1[0m The first timestamp
|
|
|
[4mtime2[0m The timestamp to subtract from the first
|
|
|
[4mSee Also[0m
|
|
|
[1mdate()[0m, [1mdatetime()[0m, [1mhumanize_duration()[0m, [1mjulianday()[0m, [1mstrftime()[0m,
|
|
|
[1mtime()[0m, [1mtimeslice()[0m, [1mtimezone()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the difference between two timestamps:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtimediff[0m[37m[40m([0m[35m[40m'2017-02-03T04:05:06'[0m[37m[40m, [0m[35m[40m'2017-02-03T04:05:00'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#2 To get the difference between relative timestamps:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtimediff[0m[37m[40m([0m[35m[40m'today'[0m[37m[40m, [0m[35m[40m'yesterday'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mtimeslice[0m[4m([0m[4mtime[0m[4m, [0m[4mslice[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Return the start of the slice of time that the given timestamp
|
|
|
falls in. If the time falls outside of the slice, NULL is returned.
|
|
|
[4mParameters[0m
|
|
|
[4mtime[0m The timestamp to get the time slice for.
|
|
|
[4mslice[0m The size of the time slices
|
|
|
[4mSee Also[0m
|
|
|
[1mdate()[0m, [1mdatetime()[0m, [1mhumanize_duration()[0m, [1mjulianday()[0m, [1mstrftime()[0m,
|
|
|
[1mtime()[0m, [1mtimediff()[0m, [1mtimezone()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To get the timestamp rounded down to the start of the ten minute slice:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtimeslice[0m[37m[40m([0m[35m[40m'2017-01-01T05:05:00'[0m[37m[40m, [0m[35m[40m'10m'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To group log messages into five minute buckets and count them:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtimeslice[0m[37m[40m([0m[37m[40mlog_time_msecs[0m[37m[40m, [0m[35m[40m'5m'[0m[37m[40m) [0m[1m[36m[40mAS[0m[37m[40m [0m[37m[40mslice[0m[37m[40m, [0m[1m[37m[40mcount[0m[37m[40m([0m[1m[37m[40m1[0m[37m[40m)[0m
|
|
|
[37m[40m [0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m[37m[40m [0m[1m[36m[40mGROUP[0m[37m[40m [0m[1m[36m[40mBY[0m[37m[40m [0m[37m[40mslice[0m
|
|
|
|
|
|
|
|
|
#3 To group log messages by those before 4:30am and after:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtimeslice[0m[37m[40m([0m[37m[40mlog_time_msecs[0m[37m[40m, [0m[35m[40m'before 4:30am'[0m[37m[40m) [0m[1m[36m[40mAS[0m[37m[40m [0m[37m[40mslice[0m[37m[40m, [0m[1m[37m[40mcount[0m[37m[40m([0m[1m[37m[40m1[0m[37m[40m) [0m[1m[36m[40mFROM[0m
|
|
|
[37m[40m [0m[37m[40mlnav_example_log[0m[37m[40m [0m[1m[36m[40mGROUP[0m[37m[40m [0m[1m[36m[40mBY[0m[37m[40m [0m[37m[40mslice[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mtimezone[0m[4m([0m[4mtz[0m[4m, [0m[4mts[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Convert a timestamp to the given timezone
|
|
|
[4mParameters[0m
|
|
|
[4mtz[0m The target timezone
|
|
|
[4mts[0m The source timestamp
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdate()[0m, [1mdatetime()[0m, [1mdecode()[0m,
|
|
|
[1mencode()[0m, [1mendswith()[0m, [1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m,
|
|
|
[1mgunzip()[0m, [1mgzip()[0m, [1mhumanize_duration()[0m, [1mhumanize_duration()[0m,
|
|
|
[1mhumanize_file_size()[0m, [1minstr()[0m, [1mjulianday()[0m, [1mleftstr()[0m, [1mlength()[0m,
|
|
|
[1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m, [1mparse_url()[0m,
|
|
|
[1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m, [1mregexp_capture_into_json()[0m,
|
|
|
[1mregexp_match()[0m, [1mregexp_replace()[0m, [1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m,
|
|
|
[1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m, [1mspooky_hash()[0m, [1mstartswith()[0m,
|
|
|
[1mstrfilter()[0m, [1mstrftime()[0m, [1msubstr()[0m, [1mtime()[0m, [1mtimediff()[0m, [1mtimeslice()[0m,
|
|
|
[1mtrim()[0m, [1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To convert a time to America/Los_Angeles:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtimezone[0m[37m[40m([0m[35m[40m'America/Los_Angeles'[0m[37m[40m, [0m[35m[40m'2022-03-02T10:00'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mtotal[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the sum of the values in the group as a floating-point.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The values to add.
|
|
|
[4mSee Also[0m
|
|
|
[1mabs()[0m, [1macos()[0m, [1macosh()[0m, [1masin()[0m, [1masinh()[0m, [1matan()[0m, [1matan2()[0m, [1matanh()[0m,
|
|
|
[1matn2()[0m, [1mavg()[0m, [1mceil()[0m, [1mdegrees()[0m, [1mexp()[0m, [1mfloor()[0m, [1mlog()[0m, [1mlog10()[0m,
|
|
|
[1mmax()[0m, [1mmin()[0m, [1mpi()[0m, [1mpower()[0m, [1mradians()[0m, [1mround()[0m, [1msign()[0m, [1msquare()[0m,
|
|
|
[1msum()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To total all of the values in the column 'ex_duration' from the table
|
|
|
'lnav_example_log':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtotal[0m[37m[40m([0m[37m[40mex_duration[0m[37m[40m) [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40mlnav_example_log[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mtotal_changes[0m[4m()[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the number of row changes caused by INSERT, UPDATE or
|
|
|
DELETE statements since the current database connection was opened.
|
|
|
|
|
|
|
|
|
[1m[4mtrim[0m[4m([0m[4mstr[0m[4m, [[0m[4mchars[0m[4m])[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a string formed by removing any and all characters that
|
|
|
appear in the second argument from the left and right sides of the
|
|
|
first.
|
|
|
[4mParameters[0m
|
|
|
[4mstr[0m The string to trim characters from the left and
|
|
|
right sides.
|
|
|
[4mchars[0m The characters to trim. Defaults to spaces.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To trim spaces from the start and end of the string ' abc ':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtrim[0m[37m[40m([0m[35m[40m' abc '[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To trim the characters '-' and '+' from the string '-+abc+-':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtrim[0m[37m[40m([0m[35m[40m'-+abc+-'[0m[37m[40m, [0m[35m[40m'-+'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mtypeof[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a string that indicates the datatype of the expression X:
|
|
|
"null", "integer", "real", "text", or "blob".
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The expression to check.
|
|
|
|
|
|
[4mExamples[0m
|
|
|
#1 To get the type of the number 1:
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtypeof[0m[37m[40m([0m[1m[37m[40m1[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
#2 To get the type of the string 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mtypeof[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4municode[0m[4m([0m[4mX[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns the numeric unicode code point corresponding to the first
|
|
|
character of the string X.
|
|
|
[4mParameter[0m
|
|
|
[4mX[0m The string to examine.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1munparse_url()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To get the unicode code point for the first character of 'abc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40municode[0m[37m[40m([0m[35m[40m'abc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4munlikely[0m[4m([0m[4mvalue[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Short-hand for likelihood(X, 0.0625)
|
|
|
[4mParameter[0m
|
|
|
[4mvalue[0m The boolean value to return
|
|
|
|
|
|
|
|
|
[1m[4munparse_url[0m[4m([0m[4mobj[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Convert a JSON object containing the parts of a URL into a URL
|
|
|
string
|
|
|
[4mParameter[0m
|
|
|
[4mobj[0m The JSON object containing the URL parts
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1mupper()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To unparse the object '{"scheme": "https", "host": "example.com"}':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40munparse_url[0m[37m[40m([0m[35m[40m'{"scheme": "https", "host": "example.com"}'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mupper[0m[4m([0m[4mstr[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a copy of the given string with all ASCII characters
|
|
|
converted to upper case.
|
|
|
[4mParameter[0m
|
|
|
[4mstr[0m The string to convert.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mxpath()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To uppercase the string 'aBc':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40mupper[0m[37m[40m([0m[35m[40m'aBc'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mxpath[0m[4m([0m[4mxpath[0m[4m, [0m[4mxmldoc[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
A table-valued function that executes an xpath expression over an
|
|
|
XML string and returns the selected values.
|
|
|
[4mParameters[0m
|
|
|
[4mxpath[0m The XPATH expression to evaluate over the XML
|
|
|
document.
|
|
|
[4mxmldoc[0m The XML document as a string.
|
|
|
[4mResults[0m
|
|
|
[4mresult[0m The result of the XPATH expression.
|
|
|
[4mnode_path[0m The absolute path to the node containing
|
|
|
the result.
|
|
|
[4mnode_attr[0m The node's attributes stored in JSON
|
|
|
object.
|
|
|
[4mnode_text[0m The node's text value.
|
|
|
[4mSee Also[0m
|
|
|
[1manonymize()[0m, [1mchar()[0m, [1mcharindex()[0m, [1mdecode()[0m, [1mencode()[0m, [1mendswith()[0m,
|
|
|
[1mextract()[0m, [1mgroup_concat()[0m, [1mgroup_spooky_hash()[0m, [1mgunzip()[0m, [1mgzip()[0m,
|
|
|
[1mhumanize_duration()[0m, [1mhumanize_file_size()[0m, [1minstr()[0m, [1mleftstr()[0m,
|
|
|
[1mlength()[0m, [1mlogfmt2json()[0m, [1mlower()[0m, [1mltrim()[0m, [1mpadc()[0m, [1mpadl()[0m, [1mpadr()[0m,
|
|
|
[1mparse_url()[0m, [1mprintf()[0m, [1mproper()[0m, [1mregexp_capture()[0m,
|
|
|
[1mregexp_capture_into_json()[0m, [1mregexp_match()[0m, [1mregexp_replace()[0m,
|
|
|
[1mreplace()[0m, [1mreplicate()[0m, [1mreverse()[0m, [1mrightstr()[0m, [1mrtrim()[0m, [1msparkline()[0m,
|
|
|
[1mspooky_hash()[0m, [1mstartswith()[0m, [1mstrfilter()[0m, [1msubstr()[0m, [1mtimezone()[0m, [1mtrim()[0m,
|
|
|
[1municode()[0m, [1munparse_url()[0m, [1mupper()[0m
|
|
|
[4mExamples[0m
|
|
|
#1 To select the XML nodes on the path '/abc/def':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[1m[37m[40mxpath[0m[37m[40m([0m[35m[40m'/abc/def'[0m[37m[40m, [0m[35m[40m'<abc><def a="b">Hello</def><def>Bye</def></abc>'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#2 To select all 'a' attributes on the path '/abc/def':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[1m[37m[40mxpath[0m[37m[40m([0m[35m[40m'/abc/def/@a'[0m[37m[40m, [0m[35m[40m'<abc><def[0m
|
|
|
[35m[40m [0m[35m[40ma="b">Hello</def><def>Bye</def></abc>'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
#3 To select the text nodes on the path '/abc/def':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[1m[37m[40mxpath[0m[37m[40m([0m[35m[40m'/abc/def/text()'[0m[37m[40m, [0m[35m[40m'<abc><def a="b">Hello[0m
|
|
|
[35m[40m [0m[35m[40m★</def></abc>'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4myaml_to_json[0m[4m([0m[4myaml[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Convert a YAML document to a JSON-encoded string
|
|
|
[4mParameter[0m
|
|
|
[4myaml[0m The YAML value to convert to JSON.
|
|
|
[4mSee Also[0m
|
|
|
[1mjget()[0m, [1mjson()[0m, [1mjson_array()[0m, [1mjson_array_length()[0m, [1mjson_concat()[0m,
|
|
|
[1mjson_contains()[0m, [1mjson_each()[0m, [1mjson_extract()[0m, [1mjson_group_array()[0m,
|
|
|
[1mjson_group_object()[0m, [1mjson_insert()[0m, [1mjson_object()[0m, [1mjson_quote()[0m,
|
|
|
[1mjson_remove()[0m, [1mjson_replace()[0m, [1mjson_set()[0m, [1mjson_tree()[0m, [1mjson_type()[0m,
|
|
|
[1mjson_valid()[0m
|
|
|
[4mExample[0m
|
|
|
#1 To convert the document "abc: def":
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40myaml_to_json[0m[37m[40m([0m[35m[40m'abc: def'[0m[37m[40m) [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4mzeroblob[0m[4m([0m[4mN[0m[4m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Returns a BLOB consisting of N bytes of 0x00.
|
|
|
[4mParameter[0m
|
|
|
[4mN[0m The size of the BLOB.
|
|
|
|
|
|
|
|
|
[1m[4m[36mATTACH[0m[4m [0m[1m[4m[36mDATABASE[0m[4m [0m[4mfilename[0m[4m [0m[1m[4m[36mAS[0m[4m [0m[4mschema-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Attach a database file to the current connection.
|
|
|
[4mParameters[0m
|
|
|
[4mfilename[0m The path to the database file.
|
|
|
[4mschema-name[0m The prefix for tables in this
|
|
|
database.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To attach the database file '/tmp/customers.db' with the name customers:
|
|
|
[37m[40m;[0m[1m[36m[40mATTACH[0m[37m[40m [0m[1m[36m[40mDATABASE[0m[37m[40m [0m[35m[40m'/tmp/customers.db'[0m[37m[40m [0m[1m[36m[40mAS[0m[37m[40m [0m[37m[40mcustomers[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4m[36mCASE[0m[4m [[0m[4mbase-expr[0m[4m] [0m[1m[4m[36mWHEN[0m[4m [0m[4mcmp-expr[0m[4m1[0m[4m [0m[1m[4m[36mTHEN[0m[4m [0m[4mthen-expr[0m[4m1[0m[4m [... [0m[1m[4m[36mWHEN[0m[4m [0m[4mcmp-expr[0m[4mN[0m[4m [0m[1m[4m[36mTHEN[0m[4m [0m[4mthen-expr[0m[4mN[0m[4m] [[0m[1m[4m[36mELSE[0m[4m [0m[4melse-expr[0m[4m] [0m[1m[4m[36mEND[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Evaluate a series of expressions in order until one evaluates to
|
|
|
true and then return it's result. Similar to an IF-THEN-ELSE
|
|
|
construct in other languages.
|
|
|
[4mParameters[0m
|
|
|
[4mbase-expr[0m The base expression that is used for
|
|
|
comparison in the branches
|
|
|
[4mcmp-expr[0m The expression to test if this branch
|
|
|
should be taken
|
|
|
[4mthen-expr[0m - The result for this branch.
|
|
|
[4melse-expr[0m The result of this CASE if no branches
|
|
|
matched.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To evaluate the number one and return the string 'one':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[36m[40mCASE[0m[37m[40m [0m[1m[37m[40m1[0m[37m[40m [0m[1m[36m[40mWHEN[0m[37m[40m [0m[1m[37m[40m0[0m[37m[40m [0m[1m[36m[40mTHEN[0m[37m[40m [0m[35m[40m'zero'[0m[37m[40m [0m[1m[36m[40mWHEN[0m[37m[40m [0m[1m[37m[40m1[0m[37m[40m [0m[1m[36m[40mTHEN[0m[37m[40m [0m[35m[40m'one'[0m[37m[40m [0m[1m[36m[40mEND[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4m[36mCREATE[0m[4m [[0m[4mTEMP[0m[4m] [0m[1m[4m[36mVIEW[0m[4m [[0m[4mIF NOT EXISTS[0m[4m] [[0m[4mschema-name.[0m[4m] [0m[4mview-name[0m[4m [0m[1m[4m[36mAS[0m[4m [0m[4mselect-stmt[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Assign a name to a SELECT statement
|
|
|
[4mParameters[0m
|
|
|
[4mIF NOT EXISTS[0m Do not create the view if it
|
|
|
already exists
|
|
|
[4mschema-name.[0m The database to create the view in
|
|
|
[4mview-name[0m The name of the view
|
|
|
[4mselect-stmt[0m The SELECT statement the view
|
|
|
represents
|
|
|
|
|
|
|
|
|
[1m[4m[36mDELETE[0m[4m [0m[1m[4m[36mFROM[0m[4m [0m[4mtable-name[0m[4m [[0m[1m[4m[36mWHERE[0m[4m [0m[4mcond[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Delete rows from a table
|
|
|
[4mParameters[0m
|
|
|
[4mtable-name[0m The name of the table
|
|
|
[4mcond[0m The conditions used to delete the rows.
|
|
|
|
|
|
|
|
|
[1m[4m[36mDETACH[0m[4m [0m[1m[4m[36mDATABASE[0m[4m [0m[4mschema-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Detach a database from the current connection.
|
|
|
[4mParameter[0m
|
|
|
[4mschema-name[0m The prefix for tables in this
|
|
|
database.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To detach the database named 'customers':
|
|
|
[37m[40m;[0m[1m[36m[40mDETACH[0m[37m[40m [0m[1m[36m[40mDATABASE[0m[37m[40m [0m[37m[40mcustomers[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4m[36mDROP[0m[4m [0m[1m[4m[36mVIEW[0m[4m [[0m[4mIF EXISTS[0m[4m] [[0m[4mschema-name.[0m[4m] [0m[4mview-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Drop a view
|
|
|
[4mParameters[0m
|
|
|
|
|
|
|
|
|
[1m[4m[36mINSERT[0m[4m [0m[1m[4m[36mINTO[0m[4m [[0m[4mschema-name.[0m[4m] [0m[4mtable-name[0m[4m [[0m[1m[4m[36m([0m[4m [0m[4mcolumn-name[0m[4m1[0m[4m [, ... [0m[4mcolumn-name[0m[4mN[0m[4m] [0m[1m[4m[36m)[0m[4m] [0m[1m[4m[36mVALUES[0m[4m [0m[1m[4m[36m([0m[4m [0m[4mexpr[0m[4m1[0m[4m [, ... [0m[4mexpr[0m[4mN[0m[4m] [0m[1m[4m[36m)[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Insert rows into a table
|
|
|
[4mParameters[0m
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To insert the pair containing 'MSG' and 'HELLO, WORLD!' into the
|
|
|
'environ' table:
|
|
|
[37m[40m;[0m[1m[36m[40mINSERT[0m[37m[40m [0m[1m[36m[40mINTO[0m[37m[40m [0m[37m[40menviron[0m[37m[40m [0m[1m[36m[40mVALUES[0m[37m[40m ([0m[35m[40m'MSG'[0m[37m[40m, [0m[35m[40m'HELLO, WORLD!'[0m[37m[40m)[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4m[36mOVER[0m[4m [0m[4mwindow-name[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Executes the preceding function over a window
|
|
|
[4mParameter[0m
|
|
|
[4mwindow-name[0m The name of the window definition
|
|
|
|
|
|
|
|
|
[1m[4m[36mSELECT[0m[4m [0m[4mresult-column[0m[4m1[0m[4m [, ... [0m[4mresult-column[0m[4mN[0m[4m] [[0m[1m[4m[36mFROM[0m[4m [0m[4mtable[0m[4m1[0m[4m [, ... [0m[4mtable[0m[4mN[0m[4m]] [[0m[1m[4m[36mWHERE[0m[4m [0m[4mcond[0m[4m] [[0m[1m[4m[36mGROUP BY[0m[4m [0m[4mgrouping-expr[0m[4m1[0m[4m [, ... [0m[4mgrouping-expr[0m[4mN[0m[4m]] [[0m[1m[4m[36mORDER BY[0m[4m [0m[4mordering-term[0m[4m1[0m[4m [, ... [0m[4mordering-term[0m[4mN[0m[4m]] [[0m[1m[4m[36mLIMIT[0m[4m [0m[4mlimit-expr[0m[4m1[0m[4m [, ... [0m[4mlimit-expr[0m[4mN[0m[4m]][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Query the database and return zero or more rows of data.
|
|
|
[4mParameters[0m
|
|
|
[4mresult-column[0m The expression used to generate a
|
|
|
result for this column.
|
|
|
[4mtable[0m The table(s) to query for data
|
|
|
[4mcond[0m The conditions used to select the
|
|
|
rows to return.
|
|
|
[4mgrouping-expr[0m The expression to use when
|
|
|
grouping rows.
|
|
|
[4mordering-term[0m The values to use when ordering
|
|
|
the result set.
|
|
|
[4mlimit-expr[0m The maximum number of rows to
|
|
|
return.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To select all of the columns from the table 'syslog_log':
|
|
|
[37m[40m;[0m[1m[36m[40mSELECT[0m[37m[40m [0m[1m[37m[40m*[0m[37m[40m [0m[1m[36m[40mFROM[0m[37m[40m [0m[37m[40msyslog_log[0m[37m[40m [0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4m[36mUPDATE[0m[4m [0m[4mtable[0m[4m [0m[1m[4m[36mSET[0m[4m [0m[4mcolumn-name[0m[4m1[0m[4m [0m[1m[4m[36m=[0m[4m [0m[4mexpr[0m[4m1[0m[4m [, ... [0m[4mcolumn-name[0m[4mN[0m[4m [0m[1m[4m[36m=[0m[4m [0m[4mexpr[0m[4mN[0m[4m] [[0m[1m[4m[36mWHERE[0m[4m [0m[4mcond[0m[4m][0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Modify a subset of values in zero or more rows of the given table
|
|
|
[4mParameters[0m
|
|
|
[4mtable[0m The table to update
|
|
|
[4mcolumn-name[0m The columns in the table to update.
|
|
|
[4mexpr[0m - The values to place into the
|
|
|
column.
|
|
|
[4mcond[0m The condition used to determine
|
|
|
whether a row should be updated.
|
|
|
|
|
|
[4mExample[0m
|
|
|
#1 To mark the syslog message at line 40:
|
|
|
[37m[40m;[0m[1m[36m[40mUPDATE[0m[37m[40m [0m[37m[40msyslog_log[0m[37m[40m [0m[1m[36m[40mSET[0m[37m[40m [0m[37m[40mlog_mark[0m[37m[40m [0m[1m[37m[40m=[0m[37m[40m [0m[1m[37m[40m1[0m[37m[40m [0m[1m[36m[40mWHERE[0m[37m[40m [0m[37m[40mlog_line[0m[37m[40m [0m[1m[37m[40m=[0m[37m[40m [0m[1m[37m[40m40[0m
|
|
|
|
|
|
|
|
|
|
|
|
[1m[4m[36mWITH[0m[4m [[0m[1m[4m[36mRECURSIVE[0m[4m] [0m[4mcte-table-name[0m[4m [0m[1m[4m[36mAS[0m[4m [0m[4mselect-stmt[0m
|
|
|
══════════════════════════════════════════════════════════════════════
|
|
|
Create a temporary view that exists only for the duration of a SQL
|
|
|
statement.
|
|
|
[4mParameters[0m
|
|
|
[4mcte-table-name[0m The name for the temporary
|
|
|
table.
|
|
|
[4mselect-stmt[0m The SELECT statement used to
|
|
|
populate the temporary table.
|