Debian Codegraph @

upstream/debian-unstable/man1/grepc.1

raw
1 .\" Copyright, the authors of the Linux man-pages project
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH grepc 1 2025-11-09 "Linux man-pages 6.18"
6 .SH NAME
7 grepc \- find declarations, definitions, and uses in source code
8 .SH SYNOPSIS
9 .B grepc
10 .RI [ option\~ .\|.\|.\&]
11 .I pattern
12 .RI [ file\~ .\|.\|.\&]
13 .SH DESCRIPTION
14 .BR grepc (1)
15 searches for declarations, definitions, and/or uses of
16 .I pattern
17 in each source
18 .IR file .
19 .P
20 .I pattern
21 is a PCRE pattern.
22 It normally represents an identifier,
23 and word boundaries are implicitly added to it in most cases.
24 .P
25 If no
26 .I file
27 is given,
28 this program reads standard input.
29 Otherwise,
30 it reads all files specified,
31 and searches under any specified directories, recursively,
32 without following symbolic links.
33 .SH OPTIONS
34 .TP
35 .BI \-A \~n
36 Print
37 .I n
38 lines of trailing context after a match.
39 .TP
40 .BI \-B \~n
41 Print
42 .I n
43 lines of leading context before a match.
44 .TP
45 .BI \-C \~n
46 Print
47 .I n
48 lines of context surrounding a match.
49 .TP
50 .B \-c
51 Do not print matches,
52 and instead print a count of them.
53 .TP
54 .B \-h
55 Suppress the prefixing of file names on output.
56 .TP
57 .B \-i
58 Ignore case distinctions in
59 .IR pattern .
60 .TP
61 .B \-l
62 Suppress normal output;
63 instead print the name of each input file
64 from which output would normally have been printed.
65 Each file is only printed once.
66 .TP
67 .BI \-m \~n
68 Stop processing after finding
69 .I n
70 matches.
71 .TP
72 .B \-n
73 Prefix each line of output with the
74 1-based line number within its input file.
75 .TP
76 .BI \-t \~type
77 Restrict the search to a specific
78 .I type
79 of code.
80 This option can be passed multiple times
81 to search for various types of code.
82 The acceptable values depend on the driver used for the language.
83 See
84 .BR grepc_c (1),
85 which is the default driver.
86 .SH CAVEATS
87 .SS Crashes
88 In some cases,
89 internal calls to
90 .BR pcre2grep (1)
91 may fail after consuming too much resources.
92 To solve that,
93 use
94 .B \-t
95 to restrict the types of code of your search.
96 .SS Seekable files
97 Files specified in the command line
98 must be seekable and able to be opened twice.
99 If you need to read a non-seekable file,
100 redirect it to the standard input.
101 .SH EXAMPLES
102 .EX
103 .RB alx@devuan:/usr/lib/gcc$ " grepc -n alignof ." ;
104 \&./x86_64\-linux\-gnu/15/include/stdalign.h:33:#define alignof _Alignof
105 .EE
106 .SH SEE ALSO
107 .BR grepc_c (1),
108 .BR pcre2grep (1),
109 .BR pcre2syntax (3),
110 .BR pcre2pattern (3)