Answers for "bash return only first line that contains match"

2

bash return only first line that contains match

# 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
Posted by: Guest on April-26-2021

Code answers related to "bash return only first line that contains match"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language