grep - deptno/deptno.github.io GitHub Wiki
grep
μ΅μ
- o : λΌμΈμ΄ μλ, λ§€μΉλ λ¨μ΄λ§ νμ
- h : ν€λ, νμΌλͺ λ±μ νμνμ§ μμ
- E : μ κ·ννμ λ§€μΉ μ¬μ©
- n : λΌμΈ νμ
- r : νΉμ ν΄λ νμλ‘ κ²μ
color
ν¨ν΄μ μΌμΉνλ κ²½μ° μ»¬λ¬λ₯Ό λΆμ¬,color=always
μ κ°μ΄ μ°λ κ²½μ° pipe λ₯Ό ν΅ν΄ less μμ 컬λ¬μ μ§κ° κ°λ₯ν¨
λͺ¨λ λΌμΈ μΆλ ₯ + νμ΄λΌμ΄νΈ
grep --color -E 'KEYWORD|$' -r [DIR]
ansi-color λ³κ²½μμλ env μ€μ νμ GREP_COLOR
GREP_COLOR='35;47' grep --color -E 'KEYWORD1|KEYWORD2|$' [FILENAME]
GREP_COLOR It is deprecated in favor of GREP_COLORS, but still supported. https://www.gnu.org/software/grep/manual/html_node/Environment-Variables.html
grep μ λΆλ¦¬ν΄μ μ¬λ¬λ² νμ΄νλ‘ μ°κ²°νλ κ²½μ° κ°κ° λ€λ₯Έ μμ λΆμ¬λ κ°λ₯ν¨
μλ§€ν
- egrep - grep -E, ν¨ν΄μ escape μμ΄ μ κ·μμΌλ‘ μ²λ¦¬νλ κ²½μ°
- fgrep - grep -F, μ κ·μμ μ¬μ©νμ§ μκ³ μ²λ¦¬νλ κ²½μ°