пятница, 15 июля 2016 г.

Mass file renaming by regexp in linux

Good bash script when you want only take part of filename using regexp for renaming

#!/bin/bash

for filename in *.m4a; do
  newFilename=$(echo $filename | \
  sed -r 's#^(.*) - (.*)-(.*).m4a$#\2.m4a#')
  mv "$filename" "$newFilename"
done

Also, you can use rename command
rename s/.mp4$/.m4a/ *.mp4

Memcached info stats

Two good tools to see data of memcached

First of all - telnet

telnet localhost 11211
and type stats

Another good tool is memcached-tool

Just type in without parameters for sample usage