常用运维操作

Mysql批量杀进程

mysql> select concat('KILL ',id,';') from information_schema.processlist where user='root';
+------------------------+
| concat('KILL ',id,';') |
+------------------------+
| KILL 3101;             |
| KILL 2946;             |
+------------------------+
2 rows in set (0.00 sec)

mysql> select concat('KILL ',id,';') from information_schema.processlist where user='root' into outfile '/tmp/a.txt';
Query OK, 2 rows affected (0.00 sec)

mysql> source /tmp/a.txt;
Query OK, 0 rows affected (0.00 sec)

文件批量合并

cat *.csv > merge.csv
cat a.csv b.csv c.csv > abc.csv

统计文本中某一列的和

$ cat test.log | awk -F '\t' '{sum+=$2}END{print sum}'
$ cat test.log | awk -F '\t' '{sum1+=$2;sum2+=$3}END{print sum2*100/sum1}'
-- EOF --
最后更新于: 2020-01-10 09:24
发表于: 2017-01-22 22:22
标签: Linux