<?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: Need shell script..... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897812#M403545</link>
    <description>Here's some links for you:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.unixguide.net/unix/sedoneliner.shtml" target="_blank"&gt;http://www.unixguide.net/unix/sedoneliner.shtml&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://pandonia.canberra.edu.au/OS/l3_1.html" target="_blank"&gt;http://pandonia.canberra.edu.au/OS/l3_1.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.shelldorado.com/shelltips/script_programmer.html" target="_blank"&gt;http://www.shelldorado.com/shelltips/script_programmer.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
    <pubDate>Mon, 25 Apr 2005 07:35:54 GMT</pubDate>
    <dc:creator>Geoff Wild</dc:creator>
    <dc:date>2005-04-25T07:35:54Z</dc:date>
    <item>
      <title>Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897791#M403524</link>
      <description>Goodday to all!&lt;BR /&gt;I am not good at shell programming...&lt;BR /&gt;I need to add in crontab a script to delete the old directory logfile.&lt;BR /&gt;For example: I just want to keep for the most 3 days current logfile directory:&lt;BR /&gt;drwxr-x---   2 am         users           96 Apr 17 12:00 20050410/&lt;BR /&gt;drwxr-x---   2 am         users           96 Apr 17 12:00 20050411/&lt;BR /&gt;drwxr-x---   2 am         users           96 Apr 18 12:00 20050412/&lt;BR /&gt;drwxr-x---   2 am         users           96 Apr 19 12:00 20050413/&lt;BR /&gt;drwxr-x---   2 am         users         8192 Apr 20 12:00 20050414/&lt;BR /&gt;drwxr-x---   2 am         users         8192 Apr 16 00:16 20050415/&lt;BR /&gt;drwxr-x---   2 am         users         8192 Apr 21 12:00 20050416/&lt;BR /&gt;drwxr-x---   2 am         users         8192 Apr 18 00:05 20050417/&lt;BR /&gt;drwxr-x---   2 am         users         8192 Apr 19 00:05 20050418/&lt;BR /&gt;drwxr-x---   2 am         users         8192 Apr 20 00:05 20050419/&lt;BR /&gt;drwxr-x---   2 am         users         8192 Apr 21 00:05 20050420/&lt;BR /&gt;drwxr-x---   2 am         users         8192 Apr 22 00:05 20050421/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In this example I just keep for these days: 21, 20, 19 and the older directory will be delete at 00:00 (by crontab)&lt;BR /&gt;&lt;BR /&gt;Any helps will be much appreciated!&lt;BR /&gt;&lt;BR /&gt;HoangChiCong</description>
      <pubDate>Fri, 22 Apr 2005 04:37:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897791#M403524</guid>
      <dc:creator>Hoang Chi Cong_1</dc:creator>
      <dc:date>2005-04-22T04:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897792#M403525</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Remove only empty directories ?&lt;BR /&gt;&lt;BR /&gt;Robert-Jan</description>
      <pubDate>Fri, 22 Apr 2005 04:43:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897792#M403525</guid>
      <dc:creator>Robert-Jan Goossens_1</dc:creator>
      <dc:date>2005-04-22T04:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897793#M403526</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;a one liner will do:&lt;BR /&gt;&lt;BR /&gt;# find &lt;MAIN directory="" of="" those="" date="" folders=""&gt; -atime +2 -type d -exec rm -R {} \;&lt;BR /&gt;&lt;BR /&gt;regards.&lt;/MAIN&gt;</description>
      <pubDate>Fri, 22 Apr 2005 04:47:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897793#M403526</guid>
      <dc:creator>Joseph Loo</dc:creator>
      <dc:date>2005-04-22T04:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897794#M403527</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I prefer using modification time above access time (Joseph's reply). If the directories are not empty, the -f option is necessary.&lt;BR /&gt;The syntax then would be:&lt;BR /&gt;find &lt;MAIN directory="" of="" those="" date="" folders=""&gt; -mtime +2 -type d -exec rm -Rf {} \;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope it helps you,&lt;BR /&gt;&lt;BR /&gt;Renarios&lt;BR /&gt;&lt;/MAIN&gt;</description>
      <pubDate>Fri, 22 Apr 2005 04:55:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897794#M403527</guid>
      <dc:creator>renarios</dc:creator>
      <dc:date>2005-04-22T04:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897795#M403528</link>
      <description>To Robert-Jan Goossens&lt;BR /&gt;Of course, it is not empty! It is logfile!&lt;BR /&gt;To Joseph Loo:&lt;BR /&gt;The full path: /home/ams/coms/log/&lt;BR /&gt;I tried with you command but nothing deleted!&lt;BR /&gt;&lt;BR /&gt;Any idea?&lt;BR /&gt;Thanks!&lt;BR /&gt;Regard,&lt;BR /&gt;HoangChiCong</description>
      <pubDate>Fri, 22 Apr 2005 05:08:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897795#M403528</guid>
      <dc:creator>Hoang Chi Cong_1</dc:creator>
      <dc:date>2005-04-22T05:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897796#M403529</link>
      <description>Including empty directory!&lt;BR /&gt;But never empty because it contain all of the logfile as my last post!</description>
      <pubDate>Fri, 22 Apr 2005 05:12:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897796#M403529</guid>
      <dc:creator>Hoang Chi Cong_1</dc:creator>
      <dc:date>2005-04-22T05:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897797#M403530</link>
      <description>Did you do as Renarios suggested and run Joseph's command with mtime rather than atime? I would expect this to work.&lt;BR /&gt;&lt;BR /&gt;Mark Syder (like the drink but spelt different)</description>
      <pubDate>Fri, 22 Apr 2005 05:29:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897797#M403530</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2005-04-22T05:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897798#M403531</link>
      <description>oops, u should be using mtime instead:&lt;BR /&gt;&lt;BR /&gt;search first&lt;BR /&gt;# find /home/ams/coms/log/ -type d -mtime +2 -exec ls -ld {} ;&lt;BR /&gt;&lt;BR /&gt;before doing this:&lt;BR /&gt;&lt;BR /&gt;# find /home/ams/coms/log/ -type d -mtime +2 -exec rm -R {} ;&lt;BR /&gt;&lt;BR /&gt;regards.</description>
      <pubDate>Fri, 22 Apr 2005 05:33:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897798#M403531</guid>
      <dc:creator>Joseph Loo</dc:creator>
      <dc:date>2005-04-22T05:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897799#M403532</link>
      <description>Mark,&lt;BR /&gt;It runs but as not I want!&lt;BR /&gt;Here are directory after run that command (with mtime):&lt;BR /&gt;&lt;BR /&gt;drwxr-x--- 2 am users 8192 Apr 20 12:00 20050414/&lt;BR /&gt;drwxr-x--- 2 am users 8192 Apr 21 12:00 20050416/&lt;BR /&gt;drwxr-x--- 2 am users 8192 Apr 20 00:05 20050419/&lt;BR /&gt;drwxr-x--- 2 am users 8192 Apr 21 00:05 20050420/&lt;BR /&gt;drwxr-x--- 2 am users 8192 Apr 22 00:05 20050421/&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;HoangChiCong</description>
      <pubDate>Fri, 22 Apr 2005 05:39:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897799#M403532</guid>
      <dc:creator>Hoang Chi Cong_1</dc:creator>
      <dc:date>2005-04-22T05:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897800#M403533</link>
      <description>The problem being that it deleted the directory for 19/4 and you wanted to keep that one?&lt;BR /&gt;&lt;BR /&gt;I would suggest changing the mtime +2 to mtime +3 (but I expect that will have to wait till Monday to confirm it's worked).&lt;BR /&gt;&lt;BR /&gt;Mark</description>
      <pubDate>Fri, 22 Apr 2005 05:45:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897800#M403533</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2005-04-22T05:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897801#M403534</link>
      <description>Try this:&lt;BR /&gt;&lt;BR /&gt;Find files modified between 3 and 8 days!!&lt;BR /&gt;&lt;BR /&gt;# find /home/ams/coms/log/ -type d -mtime +3 -mtime +8 -exec ls -ld {} ;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# find /home/ams/coms/log/ -type d -mtime +3 -mtime +8 -exec rm -R {} ;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Naveej</description>
      <pubDate>Fri, 22 Apr 2005 05:46:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897801#M403534</guid>
      <dc:creator>Naveej.K.A</dc:creator>
      <dc:date>2005-04-22T05:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897802#M403535</link>
      <description>Try this:&lt;BR /&gt;&lt;BR /&gt;Find files modified between 3 and 8 days!!&lt;BR /&gt;&lt;BR /&gt;# find /home/ams/coms/log/ -type d -mtime +3 -mtime -8 -exec ls -ld {} ;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# find /home/ams/coms/log/ -type d -mtime +3 -mtime -8 -exec rm -R {} ;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Naveej</description>
      <pubDate>Fri, 22 Apr 2005 05:47:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897802#M403535</guid>
      <dc:creator>Naveej.K.A</dc:creator>
      <dc:date>2005-04-22T05:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897803#M403536</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Download the caljd.sh (aka A. Clay Stephenson's Date Hammer) script from below link to /usr/local/bin &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://mirrors.develooper.com/hpux/#Contrib" target="_blank"&gt;http://mirrors.develooper.com/hpux/#Contrib&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Create a small script.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;CALJD=/usr/local/bin/caljd.sh&lt;BR /&gt;# set date 3 days back&lt;BR /&gt;RMDATE=$($CALJD  -Y -s $($CALJD -p 3))&lt;BR /&gt;# remove old log directory&lt;BR /&gt;/usr/bin/rm -r /home/ams/coms/log/$RMDATE&lt;BR /&gt;&lt;BR /&gt;The first time you will need to delete the older directories yourself.&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Robert-Jan</description>
      <pubDate>Fri, 22 Apr 2005 06:54:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897803#M403536</guid>
      <dc:creator>Robert-Jan Goossens_1</dc:creator>
      <dc:date>2005-04-22T06:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897804#M403537</link>
      <description>Okay - should be easy - as dirs are dates..&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;TODAY=`date +%Y%m%d`&lt;BR /&gt;DAY3=`expr $TODAY - 2`&lt;BR /&gt;&lt;BR /&gt;for LOG in `ls /home/ams/coms/log`&lt;BR /&gt;do&lt;BR /&gt;if [ `expr $LOG \&amp;lt; $DAY3` = 1 ]&lt;BR /&gt;then&lt;BR /&gt;  echo $LOG&lt;BR /&gt;  rm -rf $LOG&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Apr 2005 08:32:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897804#M403537</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2005-04-22T08:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897805#M403538</link>
      <description>Thanks to everyone...&lt;BR /&gt;Today is weekend so that I can not check for all of your script at home.&lt;BR /&gt;I will answer on next monday.&lt;BR /&gt;Later for points....&lt;BR /&gt;&lt;BR /&gt;Thanks &lt;BR /&gt;HoangChiCOng</description>
      <pubDate>Fri, 22 Apr 2005 22:55:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897805#M403538</guid>
      <dc:creator>Hoang Chi Cong_1</dc:creator>
      <dc:date>2005-04-22T22:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897806#M403539</link>
      <description>To Mark Syder:&lt;BR /&gt;I have already changed mtime to +3 but that is not I expect.&lt;BR /&gt;To Naveej:&lt;BR /&gt;Had error in your command line:"find: -exec not terminated with ';'"&lt;BR /&gt;To Robert-Jan Goossens:&lt;BR /&gt;Could you attached that shell file? Silly but I can not find that file (caljd.sh)&lt;BR /&gt;To Geoff Wild:&lt;BR /&gt;It seems that just delete all of the directory, I have tried to change to :&lt;BR /&gt;"rm -Rf $LOG" but the same!&lt;BR /&gt;&lt;BR /&gt;Any idea?&lt;BR /&gt;Thanks&lt;BR /&gt;HoangChiCong</description>
      <pubDate>Sun, 24 Apr 2005 07:10:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897806#M403539</guid>
      <dc:creator>Hoang Chi Cong_1</dc:creator>
      <dc:date>2005-04-24T07:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897807#M403540</link>
      <description>Here it is (attached and linked) :-)&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://mirrors.develooper.com/hpux/caljd-2.23.sh" target="_blank"&gt;http://mirrors.develooper.com/hpux/caljd-2.23.sh&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Robert-Jan&lt;BR /&gt;</description>
      <pubDate>Sun, 24 Apr 2005 11:19:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897807#M403540</guid>
      <dc:creator>Robert-Jan Goossens_1</dc:creator>
      <dc:date>2005-04-24T11:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897808#M403541</link>
      <description>Ah....I got it:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;TODAY=`date +%Y%m%d`&lt;BR /&gt;DAY3=`expr $TODAY - 2`&lt;BR /&gt;&lt;BR /&gt;for LOG in `ls /home/ams/coms/log`&lt;BR /&gt;do&lt;BR /&gt;if [ `expr $LOG \&amp;lt; $DAY3` = 1 ]&lt;BR /&gt;then&lt;BR /&gt;echo $LOG&lt;BR /&gt;rm -rf /home/ams/coms/log/$LOG&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Sun, 24 Apr 2005 11:37:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897808#M403541</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2005-04-24T11:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897809#M403542</link>
      <description>OK, thanks to everybody!&lt;BR /&gt;May be I have to learn shell programming. :):):)&lt;BR /&gt;Can anyone show me some usefull document that teaching shell programming? (Anyway, for beginer is suitable for me - I thinks so :(:( ).&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;Regard,&lt;BR /&gt;HoangChiCong</description>
      <pubDate>Mon, 25 Apr 2005 02:00:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897809#M403542</guid>
      <dc:creator>Hoang Chi Cong_1</dc:creator>
      <dc:date>2005-04-25T02:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need shell script.....</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897810#M403543</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;how about this doc:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B2355-90046/index.html" target="_blank"&gt;http://docs.hp.com/en/B2355-90046/index.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;regards.</description>
      <pubDate>Mon, 25 Apr 2005 02:07:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-shell-script/m-p/4897810#M403543</guid>
      <dc:creator>Joseph Loo</dc:creator>
      <dc:date>2005-04-25T02:07:02Z</dc:date>
    </item>
  </channel>
</rss>

