<?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: shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832320#M89176</link>
    <description>hi,&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;DIR="$1"&lt;BR /&gt;STRING="$2"&lt;BR /&gt;cd $1&lt;BR /&gt;grep -l "$STRING" $DIR/* 2&amp;gt;&amp;amp;-&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Jean-Louis.</description>
    <pubDate>Thu, 24 Oct 2002 06:10:21 GMT</pubDate>
    <dc:creator>Jean-Louis Phelix</dc:creator>
    <dc:date>2002-10-24T06:10:21Z</dc:date>
    <item>
      <title>shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832319#M89175</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I need a shell script which look in a directory and printout to a file only the names of the files that contain a specified string (for example "record 19"). &lt;BR /&gt;Any idea?</description>
      <pubDate>Thu, 24 Oct 2002 06:08:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832319#M89175</guid>
      <dc:creator>Ionut Grigorescu_2</dc:creator>
      <dc:date>2002-10-24T06:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832320#M89176</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;DIR="$1"&lt;BR /&gt;STRING="$2"&lt;BR /&gt;cd $1&lt;BR /&gt;grep -l "$STRING" $DIR/* 2&amp;gt;&amp;amp;-&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Jean-Louis.</description>
      <pubDate>Thu, 24 Oct 2002 06:10:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832320#M89176</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2002-10-24T06:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832321#M89177</link>
      <description>Hi,&lt;BR /&gt;you could try this:&lt;BR /&gt;# find &lt;START_DIR&gt; -type f -print | xargs grep "record 19"  | awk -F: '{print $1}' &amp;gt;outfile&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;&lt;/START_DIR&gt;</description>
      <pubDate>Thu, 24 Oct 2002 06:19:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832321#M89177</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2002-10-24T06:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832322#M89178</link>
      <description>You don't need three processes using find:&lt;BR /&gt;find &lt;START_DIR&gt; -type f -exec grep -il "record19" {} \;&lt;BR /&gt;&lt;BR /&gt;Chris&lt;/START_DIR&gt;</description>
      <pubDate>Thu, 24 Oct 2002 06:23:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832322#M89178</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2002-10-24T06:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832323#M89179</link>
      <description>Jean: merci!&lt;BR /&gt;John: the output file was empty!&lt;BR /&gt;Christian: some output but not only filenames, also content!</description>
      <pubDate>Thu, 24 Oct 2002 06:33:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832323#M89179</guid>
      <dc:creator>Ionut Grigorescu_2</dc:creator>
      <dc:date>2002-10-24T06:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832324#M89180</link>
      <description>Ionut,&lt;BR /&gt;&lt;BR /&gt;I think that any solution with find should also work and display only filenames if you use the '-l' grep option. The only problem is that it will always try to explore also any subdirectories, not only the starting points. The '-type f' limit only the grep, but not the subdirectory searches.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Jean-Louis.</description>
      <pubDate>Thu, 24 Oct 2002 06:38:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832324#M89180</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2002-10-24T06:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832325#M89181</link>
      <description>Sorry, this should work:&lt;BR /&gt;# find . -path "./*" -prune|xargs grep "record 19" |awk -F: '{print $1}'&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Oct 2002 07:19:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832325#M89181</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2002-10-24T07:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832326#M89182</link>
      <description>In the last line of Jean-Louis' script just direct the output to a file:&lt;BR /&gt;&lt;BR /&gt;grep -l "$STRING" $DIR/* &amp;gt; outputfile.out&lt;BR /&gt;&lt;BR /&gt;Chuck J</description>
      <pubDate>Thu, 24 Oct 2002 08:17:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832326#M89182</guid>
      <dc:creator>Chuck J</dc:creator>
      <dc:date>2002-10-24T08:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832327#M89183</link>
      <description>Ionut asked for file-NAME's to be of a specific patter, though you all scan in the CONTENT's of the files. Ionut's reaction however shows that you interpreted that was indeed his wish&lt;BR /&gt;&lt;BR /&gt;File names:&lt;BR /&gt;&lt;BR /&gt;# find dir | grep -i pattern&lt;BR /&gt;&lt;BR /&gt;File content, use GNU grep:&lt;BR /&gt;&lt;BR /&gt;# grep -l -r pattern dir</description>
      <pubDate>Thu, 24 Oct 2002 09:18:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832327#M89183</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-10-24T09:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832328#M89184</link>
      <description>Hi Procura,&lt;BR /&gt;&lt;BR /&gt;I meant the files that contain a specific string,&lt;BR /&gt;not the names of the files that contain a specific string :-))&lt;BR /&gt;Anyway, thanx for your care!</description>
      <pubDate>Thu, 24 Oct 2002 09:36:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832328#M89184</guid>
      <dc:creator>Ionut Grigorescu_2</dc:creator>
      <dc:date>2002-10-24T09:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832329#M89185</link>
      <description>Borrowing John's idea :&lt;BR /&gt;&lt;BR /&gt;find . -name "*" |xargs grep "ksh" |awk -F: '{print $1}'&lt;BR /&gt;&lt;BR /&gt;which cancel off the -prune, will enable the command to search further down the directory.  This might be useful sometimes.</description>
      <pubDate>Fri, 25 Oct 2002 00:26:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832329#M89185</guid>
      <dc:creator>Chia-Wei</dc:creator>
      <dc:date>2002-10-25T00:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832330#M89186</link>
      <description>I have tested all your ideas. The simpliest one is that grep -l "pattern" /&lt;DIRECTORY&gt;/* &amp;gt; output.file&lt;BR /&gt;In fact I don't need a shell script to do that. But it was a good example that in Unix there are more solutions for one problem.&lt;/DIRECTORY&gt;</description>
      <pubDate>Fri, 25 Oct 2002 06:16:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2832330#M89186</guid>
      <dc:creator>Ionut Grigorescu_2</dc:creator>
      <dc:date>2002-10-25T06:16:05Z</dc:date>
    </item>
  </channel>
</rss>

