<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: How To Find Files by Content Under UNIX</title> <atom:link href="http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/feed/" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/</link> <description>Every answer asks a more beautiful question.</description> <lastBuildDate>Fri, 10 Feb 2012 19:55:56 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: yoander</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-67858</link> <dc:creator>yoander</dc:creator> <pubDate>Wed, 08 Feb 2012 15:16:36 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-67858</guid> <description>Dave -R option means recursive so if you want to search for every *.c file that contains fred keyword you must type: grep -i ‘fred’ DIR/*.c, if exists *.c in DIR/SUBDIR then you must combine find, xargs and grep</description> <content:encoded><![CDATA[<p>Dave -R option means recursive so if you want to search for every *.c file that contains fred keyword you must type: grep -i ‘fred’ DIR/*.c, if exists *.c in DIR/SUBDIR then you must combine find, xargs and grep</p> ]]></content:encoded> </item> <item><title>By: Dave</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-67849</link> <dc:creator>Dave</dc:creator> <pubDate>Wed, 08 Feb 2012 08:31:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-67849</guid> <description>Tried
grep -iR &#039;fred&#039; *.c
only to be told *.c : no such file or directory
of course a quick look in the sub directories does reveal some *.c files.
I really would love to know why some people think linux is better than cpm... for heavens sake doesn&#039;t anything actually work with this mess?</description> <content:encoded><![CDATA[<p>Tried<br
/> grep -iR &#8216;fred&#8217; *.c<br
/> only to be told *.c : no such file or directory<br
/> of course a quick look in the sub directories does reveal some *.c files.</p><p>I really would love to know why some people think linux is better than cpm&#8230; for heavens sake doesn&#8217;t anything actually work with this mess?</p> ]]></content:encoded> </item> <item><title>By: Vijay</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-56352</link> <dc:creator>Vijay</dc:creator> <pubDate>Thu, 17 Mar 2011 12:56:57 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-56352</guid> <description>Thanks a lot for valuable posts.</description> <content:encoded><![CDATA[<p>Thanks a lot for valuable posts.</p> ]]></content:encoded> </item> <item><title>By: Carl</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-51081</link> <dc:creator>Carl</dc:creator> <pubDate>Tue, 23 Nov 2010 17:00:43 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-51081</guid> <description>thanks, didn&#039;t know that. I thought it was possible, but I didn&#039;t know how to achieve this and so the -exec option was easier, since it&#039;s pretty obvious to surround the {} with &quot;.</description> <content:encoded><![CDATA[<p>thanks, didn&#8217;t know that. I thought it was possible, but I didn&#8217;t know how to achieve this and so the -exec option was easier, since it&#8217;s pretty obvious to surround the {} with &#8220;.</p> ]]></content:encoded> </item> <item><title>By: yoander (sedlav)</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-51080</link> <dc:creator>yoander (sedlav)</dc:creator> <pubDate>Tue, 23 Nov 2010 16:58:30 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-51080</guid> <description>You can deal with path containing spaces  using -print0 and -0 options for find and xargs commands respectively</description> <content:encoded><![CDATA[<p>You can deal with path containing spaces  using -print0 and -0 options for find and xargs commands respectively</p> ]]></content:encoded> </item> <item><title>By: Carl</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-51078</link> <dc:creator>Carl</dc:creator> <pubDate>Tue, 23 Nov 2010 16:00:59 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-51078</guid> <description>I prefer using finds -exec option instead of the pipe and xargs, because with this I managed to deal with paths containing spaces, which are not searched by using the simple pipe/xargs combination in this example.
find . -type f -print -exec grep --color=auto --no-messages -nH &quot;search string&quot; &quot;{}&quot; \;</description> <content:encoded><![CDATA[<p>I prefer using finds -exec option instead of the pipe and xargs, because with this I managed to deal with paths containing spaces, which are not searched by using the simple pipe/xargs combination in this example.</p><p>find . -type f -print -exec grep &#8211;color=auto &#8211;no-messages -nH &#8220;search string&#8221; &#8220;{}&#8221; \;</p> ]]></content:encoded> </item> <item><title>By: yoander</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-38846</link> <dc:creator>yoander</dc:creator> <pubDate>Mon, 22 Sep 2008 13:51:52 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-38846</guid> <description>If you want to get a list o file where the string match the you must use -l option: grep -l &#039;main(&#039; *.c</description> <content:encoded><![CDATA[<p>If you want to get a list o file where the string match the you must use -l option: grep -l &#8216;main(&#8216; *.c</p> ]]></content:encoded> </item> <item><title>By: sathiya</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-38844</link> <dc:creator>sathiya</dc:creator> <pubDate>Mon, 22 Sep 2008 08:07:57 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-38844</guid> <description>when you want to copy all the files which contains the specified function name.,
find -iname &quot;*.c&quot; -exec grep -l &#039;main(&#039; {} \; -a -exec cp {} test1/ \;</description> <content:encoded><![CDATA[<p>when you want to copy all the files which contains the specified function name.,</p><p>find -iname &#8220;*.c&#8221; -exec grep -l &#8216;main(&#8216; {} \; -a -exec cp {} test1/ \;</p> ]]></content:encoded> </item> <item><title>By: Vaishnavi</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-38843</link> <dc:creator>Vaishnavi</dc:creator> <pubDate>Mon, 22 Sep 2008 04:18:43 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-38843</guid> <description>find . -type f -name &quot;*.c&quot; -print \
-exec grep -s &quot;main(&quot; {}\;
This command should also work</description> <content:encoded><![CDATA[<p>find . -type f -name &#8220;*.c&#8221; -print \<br
/> -exec grep -s &#8220;main(&#8221; {}\;</p><p>This command should also work</p> ]]></content:encoded> </item> <item><title>By: mhernandez</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-38842</link> <dc:creator>mhernandez</dc:creator> <pubDate>Sun, 21 Sep 2008 18:03:04 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-38842</guid> <description>@henry
find ./bin -name &quot;cp&quot;
If you were trying to find where cp program lies, you can use
which cp</description> <content:encoded><![CDATA[<p>@henry</p><p>find ./bin -name &#8220;cp&#8221;</p><p>If you were trying to find where cp program lies, you can use<br
/> which cp</p> ]]></content:encoded> </item> <item><title>By: henry</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-38841</link> <dc:creator>henry</dc:creator> <pubDate>Sun, 21 Sep 2008 17:54:28 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-38841</guid> <description>Hello,
i was trying to use the find or grep commands to search for the cp command in the ./bin directory but i couldn&#039;t get it. could you teach me how to get it. i  know it&#039;s there. just want to try out the find and the grep commands.</description> <content:encoded><![CDATA[<p>Hello,<br
/> i was trying to use the find or grep commands to search for the cp command in the ./bin directory but i couldn&#8217;t get it. could you teach me how to get it. i  know it&#8217;s there. just want to try out the find and the grep commands.</p> ]]></content:encoded> </item> <item><title>By: _</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-38837</link> <dc:creator>_</dc:creator> <pubDate>Sun, 21 Sep 2008 11:17:11 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-38837</guid> <description>egrep -ri word location/folder/*</description> <content:encoded><![CDATA[<p>egrep -ri word location/folder/*</p> ]]></content:encoded> </item> <item><title>By: vivek</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-38836</link> <dc:creator>vivek</dc:creator> <pubDate>Sun, 21 Sep 2008 10:53:14 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-38836</guid> <description>@mhernandez,
Thanks for your post, I&#039;ve update FAQ.
@Gokdeniz,
I will check it out ack and will update faq with it.
@mhymn,
Try offical pdf tool as follows:
&lt;code&gt;acroread /a search=&#039;word&#039; *.pdf&lt;/code&gt;
Appreciate all of your posts.</description> <content:encoded><![CDATA[<p>@mhernandez,</p><p>Thanks for your post, I&#8217;ve update FAQ.</p><p>@Gokdeniz,</p><p>I will check it out ack and will update faq with it.</p><p>@mhymn,</p><p>Try offical pdf tool as follows:<br
/> <code>acroread /a search='word' *.pdf</code></p><p>Appreciate all of your posts.</p> ]]></content:encoded> </item> <item><title>By: Gokdeniz Karadag</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-38835</link> <dc:creator>Gokdeniz Karadag</dc:creator> <pubDate>Sun, 21 Sep 2008 10:43:52 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-38835</guid> <description>&quot;ack&quot; is a really better alternative to grep. It is especially useful for programmers because it skips temporary files and version control files by default and searches only on code files. It searches recursively by default. check it out.
&lt;a href=&quot;http://petdance.com/ack/&quot; title=&quot;http://petdance.com/ack/&quot; rel=&quot;nofollow&quot;&gt;</description> <content:encoded><![CDATA[<p>&#8220;ack&#8221; is a really better alternative to grep. It is especially useful for programmers because it skips temporary files and version control files by default and searches only on code files. It searches recursively by default. check it out.<br
/> <a
href="http://petdance.com/ack/" title="http://petdance.com/ack/" rel="nofollow"></a></p> ]]></content:encoded> </item> <item><title>By: mhernandez</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-38833</link> <dc:creator>mhernandez</dc:creator> <pubDate>Sun, 21 Sep 2008 10:16:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-38833</guid> <description>Hi and tanks for all your tips!
I also find useful invoking grep with -nH, so that it also shows the file and the line that contains the pattern.
Sometimes, -E or -P options come handy too, because they allow me to search for regexp.
Have a lot of fun...</description> <content:encoded><![CDATA[<p>Hi and tanks for all your tips!</p><p>I also find useful invoking grep with -nH, so that it also shows the file and the line that contains the pattern.</p><p>Sometimes, -E or -P options come handy too, because they allow me to search for regexp.</p><p>Have a lot of fun&#8230;</p> ]]></content:encoded> </item> <item><title>By: mhymn</title><link>http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/#comment-38832</link> <dc:creator>mhymn</dc:creator> <pubDate>Sun, 21 Sep 2008 10:10:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1840#comment-38832</guid> <description>Thanks for the good tip,
But what a bout PDF files? you mentioned only text type of files which grep can work with them, I need to know the trick for the PDF files :/</description> <content:encoded><![CDATA[<p>Thanks for the good tip,<br
/> But what a bout PDF files? you mentioned only text type of files which grep can work with them, I need to know the trick for the PDF files :/</p> ]]></content:encoded> </item> </channel> </rss>
