📌  相关文章
📜  bash 仅返回包含匹配项的第一行 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:34.594000             🧑  作者: Mango

代码示例1
# Basic syntax:
grep -m 1 "pattern" input_file.txt
# Where -m is the maximum number of matching lines to return, i.e. stop
#    reading the file after m matches
# Note, this is more efficient than piping to head because there you
#    always read the whole file even if you're only looking for m matches