#Combine grep and tail for grepping until second match and filtering #last with tail command grep -m2 "two" in-file.txt | tail -n1