尝试使用centos 7的方式在gd swarm3安装,失败了:
sudo yum-config-manager --add-repo=https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo
sudo yum install ripgrep
使用通用linux方式安装,成功! :
wget https://github.com/BurntSushi/ripgrep/releases/download/0.10.0/ripgrep-0.10.0-x86_64-unknown-linux-musl.tar.gz
tar xzvf ripgrep-0.10.0-x86_64-unknown-linux-musl.tar.gz
sudo cp ripgrep-0.10.0-x86_64-unknown-linux-musl/rg /usr/local/bin/
使用rg对日志过滤和统计(如下来自历史命令列表):
342 rg --count-matches "MomoChat" |awk 'BEGIN{FS=":"}{print $2}'|tr -s "\n" "+"
343 rg --count-matches "media_id=102" |awk 'BEGIN{FS=":"}{print $2}'|tr -s "\n" "+"
345 rg --count-matches "media_id=102" ../20190119|awk 'BEGIN{FS=":"}{print $2}'|tr -s "\n" "+"
351 rg --count-matches "media_id=102" |awk 'BEGIN{FS=":"}{print $2}'|tr -s "\n" "+"
354 rg -m1 "media_id=102" 2019012010.txt
网友评论