本文介绍了是否有可能使用egrep来匹配范围内的数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在两组数字之间有没有办法 grep
/ egrep
?
egrepSomeText [19999-22000]/some/file.txt
它没有返回值。我希望:
$ b $ pre $ SomeText 19999 ffuuu
SomeText 20001 ffuuu
SomeText 21000 ffuuu
awk'$ 2> = 19999&& $ 2
Is there a way to grep
/egrep
between two sets of numbers?
egrep "SomeText [19999-22000]" /some/file.txt
It's not returning the values. I expect:
SomeText 19999 ffuuu
SomeText 20001 ffuuu
SomeText 21000 ffuuu
解决方案
regex is not the right tool for math stuff (although sometimes it can do), in your case, try the awk:
awk '$2>=19999 && $2<=22000' file
这篇关于是否有可能使用egrep来匹配范围内的数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!