Is it possible to use egrep to match numbers within a range?

前端 未结 2 848
北荒
北荒 2021-01-16 19:17

Is there a way to grep/egrep between two sets of numbers?

egrep \"SomeText [19999-22000]\" /some/file.txt

It\'s n

2条回答
  •  暖寄归人
    2021-01-16 20:00

    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
    

提交回复
热议问题