]> code.delx.au - gnu-emacs/blob - etc/grep.txt
Add example of grep output with context lines.
[gnu-emacs] / etc / grep.txt
1 * Introduction -*-grep-*-
2
3 This shows the different kinds of messages grep recognizes by default and
4 how they are rendered. It is intended both to help you decide which matchers
5 you need and as a test of the matchers. Move the mouse over a colored part
6 to see how much text was actually matched.
7
8 Please do not edit this file in grep-mode, it may lose escape
9 sequences on saving. Visit this file literally for editing.
10
11
12 * GNU grep 2.5.1
13
14 grep -nH -e "INFO tree" ../info/*
15 ../info/dir:6:File: dir Node: Top This is the top of the INFO tree
16
17 * GNU grep 2.5.1 with default colors
18
19 grep -nH --color=always -e "INFO tree" ../info/*
20 ../info/dir:6:File: dir Node: Top This is the top of the \e[01;31mINFO tree\e[00m
21
22 * GNU grep 2.5.1-cvs with specified minimal colors
23
24 GREP_COLORS='mt=01;31:fn=:ln=:bn=:se=:ml=:cx=:ne' grep -nH --color=always -e "INFO tree" ../info/*
25 ../info/dir:6:File: dir Node: Top This is the top of the \e[01;31mINFO tree\e[m
26
27 * GNU grep 2.5.1-cvs with default colors
28
29 grep -nH --color=always -e "INFO tree" ../info/*
30 \e[35m\e[K../info/dir\e[m\e[K\e[36m\e[K:\e[m\e[K\e[32m\e[K6\e[m\e[K\e[36m\e[K:\e[m\e[KFile: dir Node: Top This is the top of the \e[01;31m\e[KINFO tree\e[m\e[K
31
32 * GNU grep 2.5.1 on lines starting with a number and colon
33
34 grep -nH -e "Universal Time" ../lispref/*
35 ../lispref/os.texi:1010:0:00 January 1, 1970 UTC (Coordinated \e[01;31mUniversal Time\e[00m)
36
37 * GNU grep 2.5.1 with context lines
38
39 grep -C 2 -nH --color=always -e "INFO tree" ../info/*
40 ../info/dir-4-looking at that node, which is (dir)Top.
41 ../info/dir-5-\1f
42 ../info/dir:6:File: dir Node: Top This is the top of the \e[01;31mINFO tree\e[00m
43 ../info/dir-7-
44 ../info/dir-8-The Info Directory
45
46 * GNU grep 2.5.1 on files recognized as binary
47
48 Binary file emacs-7 matches
49 Binary file 2005-06 matches
50
51 * GNU grep 2.5.1: other messages
52
53 grep: ../info/dirinfo: No such file or directory
54 Grep exited abnormally with code 2 at Tue Jul 19 15:42:32
55 Grep finished with no matches found at Tue Jul 19 15:43:12
56 Grep finished (matches found) at Tue Jul 19 15:45:15
57
58 * agrep
59
60 agrep -n "INFO tree" ../info/*
61 ../info/dir: 6: File: dir Node: Top This is the top of the INFO tree
62
63 * unknown greps
64
65 grep -nH -e "xyzxyz" ../info/*
66 ../info/emacs-2:1205:10:inserts `xyzxyzxyzxyz' in the current buffer.
67 ../info/emacs-2:1205:10-15:inserts `xyzxyzxyzxyz' in the current buffer.
68 ../info/emacs-2:1205.10-1205.15:inserts `xyzxyzxyzxyz' in the current buffer.
69 ../info/emacs-2 1205.10-15 inserts `xyzxyzxyzxyz' in the current buffer.
70 ../info/emacs-2 1205.10-1205.15 inserts `xyzxyzxyzxyz' in the current buffer.
71 ../info/emacs-2 1205 inserts `xyzxyzxyzxyz' in the current buffer.
72
73 ;;; Local Variables:
74 ;;; buffer-read-only: t
75 ;;; End: