(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version



date as ordinary user date manipulation


What is this stuff?

If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):



From: "Brian K. White" <brian@aljex.com>
References: <3BE1810A.F33A07F2@yahoo.com> <3BE18982.4653E56B@aplawrence.com> <3BE191C9.C941DAD1@yahoo.com> 
Subject: Re: date
Date: Thu, 01 Nov 2001 20:29:11 GMT


----- Original Message -----
From: "Scott" <skotaylor@yahoo.com>
Newsgroups: comp.unix.sco.misc
Sent: Thursday, November 01, 2001 12:06 PM
Subject: date




> Does anyone know how to find tomorrow's date in SCO OSR5.0.5?
> Must be leap year compliant.
>
> TIA
>
> Scott

gnu date supports syntax like this, I use it for archiving log files by
date, makes it easy to split out everything older than 45 days for instance.

combined with "+%xxx" formatting strings and you can do some nice easy
splitting and grouping using simple math comparisons.


mkdir /vols
cd /vols
ftp ftp2.caldera.com
cd /pub/skunkware/osr5/shellutil/sh-utils
get sh-utils-2.0-VOLS.tar
quit
tar xvf *.tar
rm *.tar
custom
  software
    install new
    from localhost
    media images
    /vols
    install
    ok
  host
    exit




[root@aljex /vols] /usr/local/bin/date
Thu Nov  1 13:41:39 EST 2001
[root@aljex /vols] /usr/local/bin/date --d "1 day"
Fri Nov  2 13:41:43 EST 2001
[root@aljex /vols] /usr/local/bin/date --d "1 day ago"
Wed Oct 31 13:41:46 EST 2001
[root@aljex /vols]

enjoy :)

here's a couple ways I use it...

I combine this with a feature of gnu tar to use bzip2 compression internally
and another feature of gnu tar to "mv" the files into the archive, so I have
a single line of code that does a lot of things at once
# once every morning, take all of a certain group of files and archive them
# and give it a filename with yesterdays day of the week name
# this keeps a constant 7 day history of these text files which get created
and
# uploaded somewhere every 15 minutes throughout the day.
gtar cIf DAT_out_`date -d "1 day ago" +%a`.tar.bz2 --remove-files
${DATUSER}*.txt


# this part of a vsi-fax databes maintenance script I wrote that
# purges all records older than 45 days from the live database
# but keeps them archived in bzip2 compressed csv files
# runs every night. so every night it trims off one days worth of data
# from 45 days ago.

# keep DAYS number of days from cmd line , or default 45
typeset -i DAYS=${1:-45}
# date DAYS days ago in format that matches vsi-fax
CUT=`date -d "${DAYS} days ago" +%Y%m%d%H%M%S`
# get a fax sequence number from the cutoff date
typeset -i SEQ=`vdbtool unload -t "eti>${CUT}" -f seq -F pipe ${DBS}/faxreqs
|sort -n |sed -n 1p`
[...]
# export all records with sequence number below cutoff
vdbtool unload -t "seq<${SEQ}" ${DBS}/${DB} |bzip2 >${DB}-${CUT}.csv.bz2
[...]
# purge the old records from the live database
vfxpurge -o ${DAYS}
[...]

Brian K. White  --  brian@aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx  Linux SCO  Prosper/FACTS AutoCAD  #callahans Satriani








Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar


ad


/Bofcusm/967.html copyright 1997-2004 (various authors) All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.



More:
       - OSR5
       - Bofcusm


Unix/Linux Consultants

Skills Tests

Guest Post Here











My Favorites

Change Congress