Searching with grep · grep로 검색하기
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Finding text with grep
grepsearches for a word and prints only the lines that contain it:
- Out of a huge log, you instantly see just the lines that matter.
한국어
grep으로 텍스트 찾기
grep는 단어를 검색하여 해당 단어가 포함된 줄만 출력합니다:
grep error log.txt
- 방대한 로그 속에서 관련 있는 줄만을 즉시 볼 수 있습니다.
English
Useful options
-iignores case (soErrormatcheserror).-nshows the line number of each match.-vinverts — show lines that do not match.
한국어
유용한 옵션
-i는 대소문자 구분을 무시하므로(대소문자 구분이 없는),Error이error에도 일치합니다.-n는 각 일치 행의 행 번호를 표시합니다.-v는 반전하여, 일치하지 않는 줄을 표시합니다.
grep -n ok log.txt
English
grep loves pipes
grepshines at the end of a pipe, filtering another command's output:
- "How many error lines?" — filter to errors, then count them. A everyday combo.
한국어
grep과 파이프의 궁합
grep는 파이프末尾에서 빛을 발하며, 다른 명령어의 출력을 필터링합니다:
cat log.txt | grep error | wc -l
- "오류 줄은 몇 줄인가?" — 오류로 필터링한 후 세기. 일상적인 조합입니다.
English
Common mistakes
grep pattern filefinds matching lines; add-ito ignore case.- Quote a pattern that has spaces or special characters.
한국어
흔한 실수
grep pattern file가 일치하는 줄을 찾습니다. 대소문자를 무시하려면-i을 추가하세요.- 공백이나 특수문자가 포함된 패턴은 대괄호(또는 따옴표)로 묶으세요.
Explore · 탐색하기
grep inside a pipeline · 파이프 내의 grep
grep filters a stream — feed it the output of another command. · grep는 스트림을 필터링합니다 — 다른 명령어의 출력을 공급하십시오.
Show only the lines of log.txt that contain error, using grep error log.txt. · log.txt 중 error를 포함하는 줄만 보여주기 위해 grep error log.txt를 사용하십시오.
How many errors are there? Pipe grep into wc -l: grep error log.txt | wc -l. · 오류가 몇 개나 될까요? grep를 wc -l로 파이프하세요: grep error log.txt | wc -l.