Category:TXR: Difference between revisions
Content added Content deleted
(→Simple Query: [minor] Wording.) |
(→Simple Query: Revised example: using built-in math that TXR now has.) |
||
Line 52: | Line 52: | ||
<lang txr>#!/usr/bin/txr -f |
<lang txr>#!/usr/bin/txr -f |
||
@(next "/proc/meminfo") |
@(next "/proc/meminfo") |
||
@(define num (n))@\ |
|||
⚫ | |||
@(local numtok)@{numtok /[0-9]+/}@(bind n @(int-str numtok 10))@\ |
|||
MemTotal:@/ +/@TOTAL kB |
|||
⚫ | |||
⚫ | |||
@(gather) |
|||
Buffers:@/ +/@BUFS kB |
|||
MemTotal: @(num TOTAL) kB |
|||
⚫ | |||
⚫ | |||
Buffers: @(num BUFS) kB |
|||
Cached: @(num CACHED) kB |
|||
⚫ | |||
SwapTotal: @(num SWTOT) kB |
|||
⚫ | |||
⚫ | |||
@USED |
|||
⚫ | |||
⚫ | |||
⚫ | |||
@RUSED |
|||
@( |
@(bind RUSED @(- USED BUFS CACHED)) |
||
⚫ | |||
@RFREE |
|||
@( |
@(bind SWUSE @(- SWTOT SWFRE)) |
||
@SWUSE |
|||
@(output) |
@(output) |
||
TOTAL USED FREE BUFFERS CACHED |
TOTAL USED FREE BUFFERS CACHED |