기본적 사용법
grep "boot" a_file
a_file 에 담긴 내용이 다음과 같을 경우..
boot
book
booze
machine
boots
bungie
bark
aardvark
broken$tuff
robots
book
booze
machine
boots
bungie
bark
aardvark
broken$tuff
robots
$ grep "boo" a_file
boot
book
booze
boots
book
booze
boots
[라인넘버 출력]
$ grep -n "boo" a_file
1:boot
2:book
3:booze
5:boots
2:book
3:booze
5:boots
[match되지 않은 친구들 출력]
$ grep -vn "boo" a_file
4:machine
6:bungie
7:bark
8:aaradvark
9:robots
6:bungie
7:bark
8:aaradvark
9:robots
[대소문자무시]
$ grep -i "BOO" a_file
[eXact match]
$ grep -x "boo" a_file
[Regular Expressions]
$grep "e$" a_file
booze
machine
bungie
machine
bungie
출처 : http://www.uccs.edu/~ahitchco/grep/
'IT' 카테고리의 다른 글
| awk 실무활용 1편 (0) | 2008/11/24 |
|---|---|
| XP Themes (0) | 2008/10/06 |
| vi 편집기 (0) | 2008/06/11 |
| Grep 편리한 옵션들 (0) | 2008/04/10 |
| Regular Expression (2) | 2008/04/10 |
| Process Explorer & Autoruns (2) | 2008/02/18 |
| Recommended Add-ons for Internet Explorer (0) | 2008/02/13 |
| 쉘 프로그래밍 강좌 (3) | 2007/05/08 |