我的主目录中有一个 csv 文件,如下所示
cat try.csv
val1,val2,val3,val4,val5,val6
10-Jul-19,12604876601113439,Self,abs,Tier-I,30088.5
09-Jul-19,12604876601112397,Self,abs,Tier-I,200590
08-Jul-19,12604876601111807,Self,abs,Tier-I,200590
05-Jul-19,12604876601109069,Self,abs,Tier-I,70206.5
29-May-19,12604876601085648,Self,cdf,Tier-I,70206.5
30-Apr-19,12604876601068094,Self,cdf,Tier-I,130383.5
15-Nov-18,12604876600900949,Self,xyz,Tier-I,71209.46
10-Oct-18,12604876600887501,Self,xyz,Tier-I,79233.06
我可以使用grep
命令来提取包含单词'abs'的行:
grep -w 'abs' try.csv
10-Jul-19,12604876601113439,Self,abs,Tier-I,30088.5
09-Jul-19,12604876601112397,Self,abs,Tier-I,200590
08-Jul-19,12604876601111807,Self,abs,Tier-I,200590
05-Jul-19,12604876601109069,Self,abs,Tier-I,70206.5
ripgrep
但是我在https://blog.burntsushi.net/ripgrep/中遇到过它声称具有类似的功能grep
但执行速度更快(我的实际 csv 文件非常大,大小为 30gb,所以我需要一些比 更快的方法grep
)
所以我安装ripgrep
并cargo install ripgrep
运行以下代码
ripgrep -w 'abs' try.csv
但我得到以下错误
Command 'ripgrep' not found, did you mean:
command 'sipgrep' from deb sipgrep
command 'zipgrep' from deb unzip
Try: apt install <deb name>
任何以正确方式使用 ripgrep 的指针都会有所帮助