<?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: Script to get &amp;quot;last month&amp;quot; in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017838#M96831</link>
    <description>Hi Coolmar,&lt;BR /&gt;&lt;BR /&gt;How about using the find command in combination with some reference files?&lt;BR /&gt;&lt;BR /&gt;# touch -m -t 200611010001 /var/tmp/first&lt;BR /&gt;# touch -m -t 200611312359 /var/tmp/last&lt;BR /&gt;&lt;BR /&gt;# find . -type f \( -newer /var/tmp/first -a ! -newer /var/tmp/last \) -print&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Robert-Jan</description>
    <pubDate>Fri, 08 Dec 2006 10:24:18 GMT</pubDate>
    <dc:creator>Robert-Jan Goossens_1</dc:creator>
    <dc:date>2006-12-08T10:24:18Z</dc:date>
    <item>
      <title>Script to get "last month"</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017836#M96829</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am creating a script that requires me to move files from "last month".  So when ls -la the files and grep on `date +%b` (Dec)...what I actually want it to show is not this month but last month.  Is there a way to get that value?  It would be pretty simple if the dates were in numerical (Dec = 12) but with them in alpha it makes it more difficult...but I figure with you guys, not impossible ;0)&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
      <pubDate>Fri, 08 Dec 2006 10:06:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017836#M96829</guid>
      <dc:creator>Coolmar</dc:creator>
      <dc:date>2006-12-08T10:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Script to get "last month"</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017837#M96830</link>
      <description>Here's a shell script that will do it:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;THISMONTH=$(/usr/bin/date +%m)&lt;BR /&gt;&lt;BR /&gt;if (( $THISMONTH == 1 )) ; then&lt;BR /&gt;    LASTMONTH=12&lt;BR /&gt;else&lt;BR /&gt;    ((LASTMONTH=${THISMONTH}-1))&lt;BR /&gt;    echo "${THISMONTH} ${LASTMONTH}"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;case $LASTMONTH in&lt;BR /&gt;  1|01) LASTMONTHTXT=JAN ;;&lt;BR /&gt;  2|02) LASTMONTHTXT=FEB ;;&lt;BR /&gt;  3|03) LASTMONTHTXT=MAR ;;&lt;BR /&gt;  4|04) LASTMONTHTXT=APR ;;&lt;BR /&gt;  5|05) LASTMONTHTXT=MAY ;;&lt;BR /&gt;  6|06) LASTMONTHTXT=JUN ;;&lt;BR /&gt;  7|07) LASTMONTHTXT=JUL ;;&lt;BR /&gt;  8|08) LASTMONTHTXT=AUG ;;&lt;BR /&gt;  9|09) LASTMONTHTXT=SEP ;;&lt;BR /&gt;  10) LASTMONTHTXT=OCT ;;&lt;BR /&gt;  11) LASTMONTHTXT=NOV ;;&lt;BR /&gt;  12) LASTMONTHTXT=DEC ;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;echo "LAST MONTH = ${LASTMONTHTXT}"</description>
      <pubDate>Fri, 08 Dec 2006 10:19:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017837#M96830</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2006-12-08T10:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Script to get "last month"</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017838#M96831</link>
      <description>Hi Coolmar,&lt;BR /&gt;&lt;BR /&gt;How about using the find command in combination with some reference files?&lt;BR /&gt;&lt;BR /&gt;# touch -m -t 200611010001 /var/tmp/first&lt;BR /&gt;# touch -m -t 200611312359 /var/tmp/last&lt;BR /&gt;&lt;BR /&gt;# find . -type f \( -newer /var/tmp/first -a ! -newer /var/tmp/last \) -print&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Robert-Jan</description>
      <pubDate>Fri, 08 Dec 2006 10:24:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017838#M96831</guid>
      <dc:creator>Robert-Jan Goossens_1</dc:creator>
      <dc:date>2006-12-08T10:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Script to get "last month"</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017839#M96832</link>
      <description>Create a shell script:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;LASTMONTH=`date +%b | awk -f useit.awk`&lt;BR /&gt;ls -la | grep $LASTMONTH&lt;BR /&gt;&lt;BR /&gt;Create a file called useit.awk:&lt;BR /&gt;&lt;BR /&gt;BEGIN{damonth[1]="Jan";damonth[2]="Feb";damonth[3]="Mar";damonth[4]="Apr";&lt;BR /&gt;damonth[5]="May";damonth[6]="Jun";damonth[7]="Jul";damonth[8]="Aug";damonth[9]="&lt;BR /&gt;Sep";damonth[10]="Oct";damonth[11]="Nov";damonth[12]="Dec";}&lt;BR /&gt;{for (idx1 in damonth) &lt;BR /&gt;    {if (damonth[idx1]==$1) &lt;BR /&gt;       {if (idx1==1){idx=13}&lt;BR /&gt;        print damonth[idx1-1];}&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;NOTE: In the shell script, you'll need to put the full path of the file "useit.awk."&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Dec 2006 10:36:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017839#M96832</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2006-12-08T10:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Script to get "last month"</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017840#M96833</link>
      <description>&lt;!--!*#--&gt;ARCDIR=/some/place&lt;BR /&gt;&lt;BR /&gt;# get the current month&lt;BR /&gt;&lt;BR /&gt;M=`date +%b`&lt;BR /&gt;&lt;BR /&gt;for FILE in `ls -al |awk '$6ne"$M"{print $9}'`&lt;BR /&gt;do&lt;BR /&gt;    mv $FILE $ARCDIR&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Fri, 08 Dec 2006 10:40:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017840#M96833</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-12-08T10:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Script to get "last month"</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017841#M96834</link>
      <description>Knew I could count on you guys!  Thanks :0)</description>
      <pubDate>Fri, 08 Dec 2006 10:43:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-get-quot-last-month-quot/m-p/5017841#M96834</guid>
      <dc:creator>Coolmar</dc:creator>
      <dc:date>2006-12-08T10:43:31Z</dc:date>
    </item>
  </channel>
</rss>

