리눅스 문자열 매칭 행번호 확인

match string and get line number
get line number of first matching
리눅스 첫번째 매칭 행번호 확인
get line number of last matching
리눅스 마지막 매칭 행번호 확인

1 첫번째 매칭

grep -n 문자열 파일 | head -1 | cut -d ":" -f 1

2 마지막 매칭

grep -n 문자열 파일 | tail -1 | cut -d ":" -f 1

3 같이 보기

4 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}