<?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: Query in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065532#M437720</link>
    <description>&lt;!--!*#--&gt;find . -type f  | awk -F '/' '{if (NF &amp;gt; 1) {printf("%s/%s\n",$(NF - 1),$NF) } else print $0}'&lt;BR /&gt;&lt;BR /&gt;I don't see any syntax errors but this is all one line and must be entered as such/ Moreover, where I have single quotes they should be used and where I have double quotes they should be used. This will print the last directory and filename regardless of depth.</description>
    <pubDate>Tue, 28 Aug 2007 15:49:45 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2007-08-28T15:49:45Z</dc:date>
    <item>
      <title>Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065522#M437710</link>
      <description>&lt;BR /&gt;I need to trigger some action if any two of conditions are met on my system : &lt;BR /&gt;&lt;BR /&gt;I want to have a cron job running ,which on a filesystem :&lt;BR /&gt;&lt;BR /&gt;1) checks whether a file is modified then it triggers an action &lt;BR /&gt;&lt;BR /&gt;2) if a new file is created then again some action is triggered .&lt;BR /&gt;&lt;BR /&gt;Question is how to accomplish the above two  tasks through shell scripting ( no perl please since I dont know much abt it ).</description>
      <pubDate>Tue, 28 Aug 2007 10:34:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065522#M437710</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2007-08-28T10:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065523#M437711</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; checks whether a file is modified then it triggers an action&lt;BR /&gt;&lt;BR /&gt;Look at the manpages for 'touch' and 'sh-posix'.&lt;BR /&gt;&lt;BR /&gt;You can create a reference point (file) with 'touch -r' that captures your file's last modification timestamp.  Then compare what you last saw with the current value using something like 'myfile -nt reffile'.  If the you file has been updated, "do-your-thing".&lt;BR /&gt;&lt;BR /&gt;&amp;gt; if a new file is created then again some action is triggered.&lt;BR /&gt;&lt;BR /&gt;This is really a corollary of the first case.  This is *NO* such thing as a "creation" timestamp in Unix.  The "birthdate" of a file is coincidently the same as its modification timestamp when a file is first instantiated.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Aug 2007 10:45:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065523#M437711</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-28T10:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065524#M437712</link>
      <description>You need to better define your question. Do you want to know if specific files are modified/created or do you want to know if any files in an entire filesystem are modified/created?&lt;BR /&gt;&lt;BR /&gt;If you can limit it to specific files then that is reasonable. If you want to do it on an entire filesystem then that is going to be a huge resource hog. You should also be aware that there is no way to know when a file was created. UNIX does not store that data. In order to detect new files, you would have to keep a database of existing files and compare that to currently found files.&lt;BR /&gt;&lt;BR /&gt;Do a google search on "tripwire"; that may be just what you are looking for.</description>
      <pubDate>Tue, 28 Aug 2007 10:48:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065524#M437712</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-08-28T10:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065525#M437713</link>
      <description>&lt;BR /&gt;Here is what I wanted ..I figured out through the find command : &lt;BR /&gt;&lt;BR /&gt;find . -type f -mtime -1 |grep CVS |grep -v Codemagr&lt;BR /&gt;&lt;BR /&gt;this gives me the following output : &lt;BR /&gt;&lt;BR /&gt;./psystem/scrr/pms/scripts/CVS/s.install&lt;BR /&gt;&lt;BR /&gt;..now I want to strip down the the output in which I can cd to psystem/scrr/pms/scripts only. How to get this output ? Please note that the depth can vary... ( basically I want to cut the last 2 fields - starting with /CVS/s.install)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Aug 2007 12:18:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065525#M437713</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2007-08-28T12:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065526#M437714</link>
      <description>JRF /Clay .. can you help please....&lt;BR /&gt;&lt;BR /&gt;thanks.</description>
      <pubDate>Tue, 28 Aug 2007 12:45:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065526#M437714</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2007-08-28T12:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065527#M437715</link>
      <description>There are many ways to do this (here's one using your existing find output to feed awk):&lt;BR /&gt;&lt;BR /&gt;find . -type f ..... | awk -F '/' '{if (NF &amp;gt; 1) {printf("%s/%s\n",$(NF - 1),$NF) } else print $0}'&lt;BR /&gt;&lt;BR /&gt;You could also use cut specifying a field separator. You really should get away from using grep, especially without anchored expressions, because you are going to get things you don't exit.&lt;BR /&gt;&lt;BR /&gt;For example, grep tom will get tom,tommy,atom,atomic,anatomy when all you wanted was "tom".</description>
      <pubDate>Tue, 28 Aug 2007 13:44:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065527#M437715</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-08-28T13:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065528#M437716</link>
      <description>Thanks for the reply Clay , but its giving me a syntax error .</description>
      <pubDate>Tue, 28 Aug 2007 13:59:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065528#M437716</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2007-08-28T13:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065529#M437717</link>
      <description>I removed the space between -F and '/' and it removed the syntax error but the output I am getting now is not what i originally wanted :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%s/%s&lt;BR /&gt; CVS s&lt;BR /&gt;&lt;BR /&gt;I wanted : &lt;BR /&gt;&lt;BR /&gt;psystem/scrr/pms/scripts&lt;BR /&gt;&lt;BR /&gt;OR &lt;BR /&gt;&lt;BR /&gt;psystem/scrr/pms/scripts/&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Aug 2007 14:53:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065529#M437717</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2007-08-28T14:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065530#M437718</link>
      <description>If you know you want under psystem/scrr/pms/scripts, you should start your find there.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;grep CVS |grep -v Codemagr&lt;BR /&gt;&lt;BR /&gt;You can code these in the find itself:&lt;BR /&gt;find . -type f -mtime -1 -path "*/CVS/*" ! -path "*/Codemagr/*"&lt;BR /&gt;&lt;BR /&gt;&amp;gt;but the output I am getting now is not what i originally wanted:&lt;BR /&gt;&lt;BR /&gt;Did you want the last two directory components?  Or to remove them?&lt;BR /&gt;&lt;BR /&gt;You might want to use a nested dirname(2):&lt;BR /&gt;find . | xargs -n1 dirname | xargs -n1 dirname | sort -u&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Aug 2007 15:29:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065530#M437718</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-28T15:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065531#M437719</link>
      <description>Finally its very near but yet so far : &lt;BR /&gt;&lt;BR /&gt;find . -type f -mtime -1 |grep CVS |grep -v Codemagr|awk -F"./" '{print $2}'|awk -F"CVS" '{print $1}'&lt;BR /&gt;&lt;BR /&gt;and getting :&lt;BR /&gt;&lt;BR /&gt;/psystem/scrr/pms/scripts/&lt;BR /&gt;&lt;BR /&gt;and I want : &lt;BR /&gt;&lt;BR /&gt;psystem/scrr/pms/scripts/&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Aug 2007 15:40:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065531#M437719</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2007-08-28T15:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065532#M437720</link>
      <description>&lt;!--!*#--&gt;find . -type f  | awk -F '/' '{if (NF &amp;gt; 1) {printf("%s/%s\n",$(NF - 1),$NF) } else print $0}'&lt;BR /&gt;&lt;BR /&gt;I don't see any syntax errors but this is all one line and must be entered as such/ Moreover, where I have single quotes they should be used and where I have double quotes they should be used. This will print the last directory and filename regardless of depth.</description>
      <pubDate>Tue, 28 Aug 2007 15:49:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065532#M437720</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-08-28T15:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065533#M437721</link>
      <description>&lt;!--!*#--&gt;find . -type f  | awk -F '/' '{if (NF &amp;gt; 1) {printf("%s/%s\n",$(NF - 1),$NF) } else print $0}'&lt;BR /&gt;&lt;BR /&gt;I'll try again using the retain format option.</description>
      <pubDate>Tue, 28 Aug 2007 15:51:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065533#M437721</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-08-28T15:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065534#M437722</link>
      <description>&amp;gt;and getting: /psystem/scrr/pms/scripts/&lt;BR /&gt;&amp;gt;and I want : psystem/scrr/pms/scripts/&lt;BR /&gt;&lt;BR /&gt;If you want to remove the first "/", you can use sed:&lt;BR /&gt; ... | sed 's:^/::'&lt;BR /&gt;&lt;BR /&gt;Or awk's substr function: substr($0, 2)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Aug 2007 15:55:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065534#M437722</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-28T15:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065535#M437723</link>
      <description>Thanks Clay / Dennis.</description>
      <pubDate>Tue, 28 Aug 2007 16:00:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/query/m-p/5065535#M437723</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2007-08-28T16:00:23Z</dc:date>
    </item>
  </channel>
</rss>

