大佬教程收集整理的这篇文章主要介绍了获取与特定模式匹配的前n行(使用Linux命令),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
-m NUM,--max-count=NUM Stop reading a file after NUM matching lines. If the input is standard input from a regular file,and NUM matching lines are output,grep ensures that the standard input is positioned to just after the last matching line before exiTing,regardless of the presence of Trailing context lines. This enables a calling process to resume a search.
所以可以使用
grep model old_file_name.txt -m 5 > new_file_name.txt
以上是大佬教程为你收集整理的获取与特定模式匹配的前n行(使用Linux命令)全部内容,希望文章能够帮你解决获取与特定模式匹配的前n行(使用Linux命令)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。