ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux xargs 命令

Linux xargs 命令

原创 Linux操作系统 作者:壹頁書 时间:2014-06-13 00:52:55 3 删除 编辑
xargs这个命令感觉挺有用的
比如批量删除redis 以某个字符作为开头的条目。

删除key以mvbox开头的所有条目:
  1. redis-cli keys "mvbox_*" | xargs redis-cli del
或者

  1. [lihuilin@lihuilin ~]$ cat test.txt
  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. [lihuilin@lihuilin ~]$ cat test.txt | xargs -i echo delete user where id={}
  8. delete user where id=1
  9. delete user where id=2
  10. delete user where id=3
  11. delete user where id=4
  12. delete user where id=5



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29254281/viewspace-1181868/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: MongoDB分片
请登录后发表评论 登录
全部评论

注册时间:2013-10-19

  • 博文量
    620
  • 访问量
    6339932