FG
💻 Software

How can I grep in source files for some text?

Fresh7 days ago
Mar 15, 20266892 views
Confidence Score0%
0%

Problem

At the moment I'm using two commands, I'm sure there must be a better way...

Error Output

wim@wim-acer:~/ffmpeg$ find . -name "*.h" -print0 | xargs -0 grep -i invalid\ preset
wim@wim-acer:~/ffmpeg$ find . -name "*.c" -print0 | xargs -0 gre…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I grep in source files for some text?

Low Risk

ack (or, on Debian/Ubuntu, ack-grep) will ignore non-source files like version control or binaries. Very useful. to search just .c and .h files, as above: the (the longer form is ) only looks at .c .h & .xs files. The full list of filetypes is viewa…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment