fromkv
Records are generated from character input with the form "<record><record-delim><record>...".
Synopsis
bash
recs fromkv [options] [<files>]Description
Records are generated from character input with the form "<record><record-delim><record>...". Records have the form "<entry><entry-delim><entry>...". Entries are pairs of the form "<key><kv-delim><value>".
Options
| Flag | Description |
|---|---|
--kv-delim / -f <delim> | Delimiter for separating key/value pairs within an entry (default ' '). |
--entry-delim / -e <delim> | Delimiter for separating entries within records (default '\n'). |
--record-delim / -r <delim> | Delimiter for separating records (default 'END\n'). |
Examples
Parse memcached stat metrics into records
bash
echo -ne 'stats\r\n' | nc -i1 localhost 11211 | tr -d '\r' | awk '{if (! /END/) {print $2" "$3} else {print $0}}' | recs fromkvParse records separated by 'E\n' with entries separated by '|' and pairs separated by '='
bash
recs fromkv --kv-delim '=' --entry-delim '|' --record-delim $(echo -ne 'E\n')