<?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 grep and remove in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-and-remove/m-p/2576639#M858643</link>
    <description>I'm trying to list files inside a directory that includes all of Jan - Dec 2000, after which I want to delete all of them since it's building up space.&lt;BR /&gt;&lt;BR /&gt;Is there of syntax I should use to grab all files between jan through Dec and delete it also??&lt;BR /&gt;&lt;BR /&gt;Need help..&lt;BR /&gt;&lt;BR /&gt;Jade</description>
    <pubDate>Thu, 06 Sep 2001 21:55:09 GMT</pubDate>
    <dc:creator>Jade Bulante</dc:creator>
    <dc:date>2001-09-06T21:55:09Z</dc:date>
    <item>
      <title>grep and remove</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-and-remove/m-p/2576639#M858643</link>
      <description>I'm trying to list files inside a directory that includes all of Jan - Dec 2000, after which I want to delete all of them since it's building up space.&lt;BR /&gt;&lt;BR /&gt;Is there of syntax I should use to grab all files between jan through Dec and delete it also??&lt;BR /&gt;&lt;BR /&gt;Need help..&lt;BR /&gt;&lt;BR /&gt;Jade</description>
      <pubDate>Thu, 06 Sep 2001 21:55:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-and-remove/m-p/2576639#M858643</guid>
      <dc:creator>Jade Bulante</dc:creator>
      <dc:date>2001-09-06T21:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: grep and remove</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-and-remove/m-p/2576640#M858644</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;We can take advantage of JulianDays to do this:&lt;BR /&gt;Today 09/06/2001 is JD 2452159; 01/01/2000 is JD 2451545; 12/31/2000 is JD 2451910. &lt;BR /&gt;Today - 12/31/2000 = 249; Today - 01/01/2000 = 614.&lt;BR /&gt;So I want to get all regular files in the current directory files older than 248 days and younger than 613 days.&lt;BR /&gt;&lt;BR /&gt;Here is a test version of the command:&lt;BR /&gt;find . -type f \( -mtime +248 -a -mtime -613 \) -exec ls -l {} \;&lt;BR /&gt;&lt;BR /&gt;Here is a actual version of the command (MAKE CERTAIN YOU ARE IN THE DESIRED DIRECTORY):&lt;BR /&gt;find . -type f \( -mtime +248 -a -mtime -613 \) -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;Man find for details. In case you are wondering about how I got those strange Julian Days, I've attached the script.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Sep 2001 22:18:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-and-remove/m-p/2576640#M858644</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-09-06T22:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: grep and remove</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-and-remove/m-p/2576641#M858645</link>
      <description>Hi Jade:&lt;BR /&gt;&lt;BR /&gt;Since you want to remove all files whose modification timestamp is for the year 2000, we could do this:&lt;BR /&gt;&lt;BR /&gt;# cd &lt;DIR&gt;&lt;BR /&gt;# ls -al | awk '$8~/2000/ {system("rm " $9)}'&lt;BR /&gt;&lt;BR /&gt;This will remove all *files* (field-9 in the 'ls' output), while skipping directories (because 'rm' doesn't remove them), whose modification timestamp (field-8 in the 'ls') is "2000".&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/DIR&gt;</description>
      <pubDate>Thu, 06 Sep 2001 23:17:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-and-remove/m-p/2576641#M858645</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-09-06T23:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: grep and remove</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-and-remove/m-p/2576642#M858646</link>
      <description>Hi Jade:&lt;BR /&gt;&lt;BR /&gt;Here?s yet another way to meet your objective.  &lt;BR /&gt;&lt;BR /&gt;One of the values of using ?find? is that it recursively descends the directory you specify.  Try this for a solution.&lt;BR /&gt;&lt;BR /&gt;# cd mydir&lt;BR /&gt;# touch ?mt 200001010000 myref1&lt;BR /&gt;# touch ?mt 200012312359 myref2&lt;BR /&gt;# find . -type f -newer myref1 -a ! -newer myref2 | awk '{system("rm " $0)}'&lt;BR /&gt;# rm myref1 myref2&lt;BR /&gt;&lt;BR /&gt;This will find and remove all files whose modification timestamp is more recent than ?myref1? (here, Jan 1, 2000 at 0000) and equal or less than ?myref2? (here, Dec 31, 2000 at 2359).&lt;BR /&gt;&lt;BR /&gt;In reality, the file ?myref2? will be removed as a part of the ?find? process.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 07 Sep 2001 13:07:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-and-remove/m-p/2576642#M858646</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-09-07T13:07:52Z</dc:date>
    </item>
  </channel>
</rss>

