小编Kev*_*vin的帖子

仅从文件中提取电话号码

我确定这个问题的答案已经在线,但我不知道我在找什么.我刚刚开始学习Unix/Linux课程,我爸爸让我为他的工作做点什么.他有一个文本文件,每隔四行就有一个10位数字.我如何列出数字列表?我假设文件看起来像这样:

Random junk
Random junk fake number 1234567809
Random junk
My phone number is 1234567890 and it is here random numbers 32131;1231
Random junk
Random junk another fake number 2345432345
Random junk
Just kidding my phone number is here 1234567890 the date is mon:1231:31231
Run Code Online (Sandbox Code Playgroud)

我假设它像grep [1-9].\{9\}文件,但我怎么得到线4,8,12等因为我测试它,我得到每一行的所有电话号码.另外我怎么得到的数字不是整行?

任何帮助将不胜感激,即使它指向我正确的方向,所以我可以自己研究它.谢谢.

regex unix linux grep file

5
推荐指数
1
解决办法
230
查看次数

标签 统计

file ×1

grep ×1

linux ×1

regex ×1

unix ×1