<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: find a string in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325011#M188085</link>
    <description>Try&lt;BR /&gt;&lt;BR /&gt;find . -type f -exec grep -il "abc" {} \;&lt;BR /&gt;&lt;BR /&gt;or, if you're on HP-UX 11.*, &lt;BR /&gt;&lt;BR /&gt;find . -type f -exec grep -il "abc" +&lt;BR /&gt;&lt;BR /&gt;which is slightly faster in execution.</description>
    <pubDate>Wed, 07 Jul 2004 06:02:03 GMT</pubDate>
    <dc:creator>Chris Wilshaw</dc:creator>
    <dc:date>2004-07-07T06:02:03Z</dc:date>
    <item>
      <title>find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325010#M188084</link>
      <description>I want to find the string "abc" in the path /etc like below script , but the reason only show the content of the file but not the file name , how can I know which file(s) contains the string ? thx.&lt;BR /&gt;&lt;BR /&gt;#cd /etc&lt;BR /&gt;#find . -type f -exec grep -i "abc" {} \; &lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jul 2004 05:57:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325010#M188084</guid>
      <dc:creator>peterchu</dc:creator>
      <dc:date>2004-07-07T05:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325011#M188085</link>
      <description>Try&lt;BR /&gt;&lt;BR /&gt;find . -type f -exec grep -il "abc" {} \;&lt;BR /&gt;&lt;BR /&gt;or, if you're on HP-UX 11.*, &lt;BR /&gt;&lt;BR /&gt;find . -type f -exec grep -il "abc" +&lt;BR /&gt;&lt;BR /&gt;which is slightly faster in execution.</description>
      <pubDate>Wed, 07 Jul 2004 06:02:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325011#M188085</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2004-07-07T06:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325012#M188086</link>
      <description>use grep -l "abc"&lt;BR /&gt;&lt;BR /&gt;sks</description>
      <pubDate>Wed, 07 Jul 2004 06:03:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325012#M188086</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-07-07T06:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325013#M188087</link>
      <description>How about a simple..&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;"cd /etc;grep abc *" &lt;BR /&gt; &lt;BR /&gt;This will give you the line with the contents and the file name.&lt;BR /&gt; &lt;BR /&gt;You could get cleverer though with&lt;BR /&gt; &lt;BR /&gt;"grep abc * | cut -d: -f1 | sort -u"&lt;BR /&gt; &lt;BR /&gt;This will give you just the filenames&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jul 2004 06:05:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325013#M188087</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-07-07T06:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325014#M188088</link>
      <description>This works &lt;BR /&gt;cd /etc&lt;BR /&gt;find . -type f -print -exec grep -i "&lt;STRING&gt;" {} \;&lt;BR /&gt;&lt;BR /&gt;Bye &lt;BR /&gt;Bruno&lt;BR /&gt;&lt;/STRING&gt;</description>
      <pubDate>Wed, 07 Jul 2004 06:13:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325014#M188088</guid>
      <dc:creator>Bruno Ganino</dc:creator>
      <dc:date>2004-07-07T06:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325015#M188089</link>
      <description>I think we've all been outshone but sanjay on this one Bruno :)</description>
      <pubDate>Wed, 07 Jul 2004 06:14:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325015#M188089</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-07-07T06:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325016#M188090</link>
      <description>Hi,&lt;BR /&gt;This is how it works for me:&lt;BR /&gt;# ll&lt;BR /&gt;total 32&lt;BR /&gt;-rw-rw-rw-   1 root       sys              2 Jul  7 16:45 one&lt;BR /&gt;-rw-rw-rw-   1 root       sys              2 Jul  7 16:45 two&lt;BR /&gt;# grep 1 *&lt;BR /&gt;one:1&lt;BR /&gt;# cat one&lt;BR /&gt;1&lt;BR /&gt;# cat two&lt;BR /&gt;2&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;So it show me the string as well as the file name.&lt;BR /&gt;&lt;BR /&gt;Regards,</description>
      <pubDate>Wed, 07 Jul 2004 06:16:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325016#M188090</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2004-07-07T06:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325017#M188091</link>
      <description>you can also use the -print option</description>
      <pubDate>Wed, 07 Jul 2004 06:19:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325017#M188091</guid>
      <dc:creator>florence mathon lermusi</dc:creator>
      <dc:date>2004-07-07T06:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325018#M188092</link>
      <description>Hi,&lt;BR /&gt;Dear peterchu,&lt;BR /&gt;Please don't forget to assign points.&lt;BR /&gt;This is from your profile&lt;BR /&gt;"I have assigned points to   188  of   394  responses to my questions."&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jul 2004 06:19:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325018#M188092</guid>
      <dc:creator>Shaikh Imran</dc:creator>
      <dc:date>2004-07-07T06:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325019#M188093</link>
      <description>Else with this script:&lt;BR /&gt;&lt;BR /&gt;cd /etc&lt;BR /&gt;for i in $(find . -type f)&lt;BR /&gt;do&lt;BR /&gt;tipo_fich=$(file $i|grep "abc")&lt;BR /&gt;if [ $? -eq 0 ];then&lt;BR /&gt;echo "Filename = $i"&amp;gt;&amp;gt;/tmp/fich.out&lt;BR /&gt;grep -n "abc" $i&amp;gt;&amp;gt;/tmp/fich.out&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;Bruno&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jul 2004 06:20:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325019#M188093</guid>
      <dc:creator>Bruno Ganino</dc:creator>
      <dc:date>2004-07-07T06:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325020#M188094</link>
      <description>find /etc -type f | xargs grep -il "abc"&lt;BR /&gt;would maybe be better (only one grep process)&lt;BR /&gt;&lt;BR /&gt;I suppose that your want subdirectories. If not, use&lt;BR /&gt;grep -il "abc" *&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jul 2004 06:21:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325020#M188094</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-07-07T06:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325021#M188095</link>
      <description>grep "xyz" * | cut -d ":" -f 1</description>
      <pubDate>Wed, 07 Jul 2004 06:27:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325021#M188095</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2004-07-07T06:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: find a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325022#M188096</link>
      <description>Hai,&lt;BR /&gt;&lt;BR /&gt;  If you want to do in the /etc/ directory and not in it's sub directory then,&lt;BR /&gt;&lt;BR /&gt; grep 'abc' /etc/*&lt;BR /&gt;&lt;BR /&gt; If you want to do it in recursive manner then,&lt;BR /&gt;&lt;BR /&gt; grep 'abc' `find &lt;PATH&gt; -name "*"` or&lt;BR /&gt; grep 'abc' `find &lt;PATH&gt; -type "*"`&lt;BR /&gt;&lt;BR /&gt; It will search in all files. Your requirement is having a problem that search operation of abc will be done including objects too. It will prompt garbage symbols etc...!!!&lt;BR /&gt;&lt;BR /&gt; Another way you can do is,&lt;BR /&gt; &lt;BR /&gt; find . -type f -exec &amp;lt;script-name&amp;gt; {} \;&lt;BR /&gt;&lt;BR /&gt; Use the {} value as a file name, make the script to grep the content for that.&lt;BR /&gt;&lt;BR /&gt; #!/usr/bin/ksh&lt;BR /&gt; filename=$1&lt;BR /&gt; &lt;BR /&gt; echo "$filaname  $(grep -q 'abc' $filename)"&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Muthukumar.&lt;BR /&gt; &lt;BR /&gt;&lt;/PATH&gt;&lt;/PATH&gt;</description>
      <pubDate>Wed, 07 Jul 2004 06:37:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-a-string/m-p/3325022#M188096</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-07-07T06:37:50Z</dc:date>
    </item>
  </channel>
</rss>

