Fetch the value of a key from memcache server with telnet

In case you want to fetch the value of a key stored in a memcache you could connect to the memcache server via telnet and query the server for the key:

Connect to the memcache server via telnet:
:$ telnet memcache-server-host 11211

Query for stats slabs and use the slab number t query with cachedump:

stats slabs
STAT 25:chunk_size 21696
STAT 25:chunks_per_page 48
...
END

stats cachedump 25 0
ITEM GTLD_DATA [18459 b; 1520683204 s]
END

get GTLD_DATA
VALUE GTLD_DATA 1 18459
a:2:{...}
END

Read more:

How to fetch field(s) from MySQL query result in bash

In case you want to fetch/export the result of a mysql query into a text file, but you don´t have the option to use the OUTFILE command you can simple use the following bash command:

:~$ mysql -u USER -p PASSWORD -h HOST --silent --skip-column-names -e 'select field1, field2, field3 from table' > query-result.csv