<?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: search for string in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760333#M259237</link>
    <description>Hi Rogerio:&lt;BR /&gt;&lt;BR /&gt;This will restrict your search to "text" files, grep for your token and output the name of the file(s) containing the matching tokens:&lt;BR /&gt;&lt;BR /&gt;# cat ./match&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# $1=directory $2=token_to_match&lt;BR /&gt;find $1 -xdev -type f -exec file {} \; | \&lt;BR /&gt;  awk -v TOKEN=$2 '/text$/ {split($1,a,":");&lt;BR /&gt;    system("grep " TOKEN " " a[1] " /dev/null")}'&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;...run as:&lt;BR /&gt;&lt;BR /&gt;# ./match path token&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Tue, 28 Mar 2006 08:04:10 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2006-03-28T08:04:10Z</dc:date>
    <item>
      <title>search for string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760330#M259234</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I need to search through all the files on my server and produce a list of only those files that contain the text FPRD within the file. I want to ignore binary files, if possible.&lt;BR /&gt;&lt;BR /&gt;Thanks ..</description>
      <pubDate>Tue, 28 Mar 2006 07:03:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760330#M259234</guid>
      <dc:creator>rogerio_1</dc:creator>
      <dc:date>2006-03-28T07:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: search for string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760331#M259235</link>
      <description>find . -type f -print \; | while read a&lt;BR /&gt;do&lt;BR /&gt;grep -q 'FPRD' ${a}&lt;BR /&gt;if [ "$?" -eq "0" ];then&lt;BR /&gt;echo "File has FPRD in it-${a}"&lt;BR /&gt;else&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2006 07:07:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760331#M259235</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-03-28T07:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: search for string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760332#M259236</link>
      <description>Rogerio,&lt;BR /&gt;&lt;BR /&gt;Try the following&lt;BR /&gt;&lt;BR /&gt;find ./ | while read filename&lt;BR /&gt;do&lt;BR /&gt;if test `file $filename | cut -f 2 -d ":" | grep -c text` != "0"&lt;BR /&gt;  then&lt;BR /&gt;     grep -l test $filename&lt;BR /&gt; fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ninad</description>
      <pubDate>Tue, 28 Mar 2006 07:28:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760332#M259236</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-03-28T07:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: search for string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760333#M259237</link>
      <description>Hi Rogerio:&lt;BR /&gt;&lt;BR /&gt;This will restrict your search to "text" files, grep for your token and output the name of the file(s) containing the matching tokens:&lt;BR /&gt;&lt;BR /&gt;# cat ./match&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# $1=directory $2=token_to_match&lt;BR /&gt;find $1 -xdev -type f -exec file {} \; | \&lt;BR /&gt;  awk -v TOKEN=$2 '/text$/ {split($1,a,":");&lt;BR /&gt;    system("grep " TOKEN " " a[1] " /dev/null")}'&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;...run as:&lt;BR /&gt;&lt;BR /&gt;# ./match path token&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 28 Mar 2006 08:04:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760333#M259237</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-03-28T08:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: search for string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760334#M259238</link>
      <description>I usually to the following&lt;BR /&gt;&lt;BR /&gt;In a directory,&lt;BR /&gt;use (ls -R1) for recursive:&lt;BR /&gt;&lt;BR /&gt;for afile in $(ls -1)&lt;BR /&gt;do&lt;BR /&gt;if (file $afile | grep ascii)&lt;BR /&gt;then &lt;BR /&gt;grep -in "your string" $afile&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2006 08:06:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760334#M259238</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2006-03-28T08:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: search for string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760335#M259239</link>
      <description>Hi rogerio,&lt;BR /&gt;&lt;BR /&gt;find / -type f -exec grep -l FPRD {} \;&lt;BR /&gt;&lt;BR /&gt;will do that. &lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2006 08:16:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760335#M259239</guid>
      <dc:creator>Antonio Cardoso_1</dc:creator>
      <dc:date>2006-03-28T08:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: search for string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760336#M259240</link>
      <description>Hi,&lt;BR /&gt;cd &lt;YOUR work="" directory=""&gt;&lt;BR /&gt;grep FPRD $(file *|grep text|cut -d":" -f1)&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art&lt;/YOUR&gt;</description>
      <pubDate>Wed, 29 Mar 2006 06:08:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760336#M259240</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-03-29T06:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: search for string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760337#M259241</link>
      <description>Hi,&lt;BR /&gt;my previous reply look for FPRD in a directory only.&lt;BR /&gt;&lt;BR /&gt;If you want to look for teh same on all your system:&lt;BR /&gt;# Search string "hello world" only in text files including subdirectories&lt;BR /&gt;grep "hello world" $(find ./ -name "*" -print -exec file {} \; | grep text | cut -d ':' -f 1)&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Mar 2006 06:12:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/search-for-string/m-p/3760337#M259241</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-03-29T06:12:36Z</dc:date>
    </item>
  </channel>
</rss>

