xargs这个命令感觉挺有用的
比如批量删除redis 以某个字符作为开头的条目。
删除key以mvbox开头的所有条目:
-
redis-cli keys "mvbox_*" | xargs redis-cli del
或者
-
[lihuilin@lihuilin ~]$ cat test.txt
-
1
-
2
-
3
-
4
-
5
-
[lihuilin@lihuilin ~]$ cat test.txt | xargs -i echo delete user where id={}
-
delete user where id=1
-
delete user where id=2
-
delete user where id=3
-
delete user where id=4
-
delete user where id=5
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29254281/viewspace-1181868/
,如需转载,请注明出处,否则将追究法律责任。