Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20220311] Linux - grep #251

Open
JuHyun419 opened this issue Mar 11, 2022 · 0 comments
Open

[20220311] Linux - grep #251

JuHyun419 opened this issue Mar 11, 2022 · 0 comments
Labels

Comments

@JuHyun419
Copy link
Owner

Linux - grep

  • -i : 대소문자 무시
  • -A(after context) : grep 이후 라인
  • -B(before context) : grep 이전 라인
  • -C(context) : grep 이전, 이후 라인
  • -r : recursive
  • -l : 결과값은 제외하고 파일명만 출력
  • -v : 검색할 때 제외할 문자
// 현재 디렉토리 하위에서 *.log* 파일을 제외한 모든 파일에서 01011112222를 찾아서 파일명만 출력
grep -rl --exclued='*.log*' "01011112222" ./*

// logfile.log 파일에서 request(대소문자 모두 포함)문자가 포함된 행의 이후 10라인까지 함께 출력
grep -iA10 'request' logfile.log

// 앞(뒤)에서 50라인만 출력
grep -iA10 'request' logfile.log | head(tail) -n 50

// history 목록에서 
history | grep -v cd | grep -v ll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant