- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: exporting date range
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 02:13 AM
08-03-2006 02:13 AM
exporting date range
I have a script where I am exporting today's date, but I really want to export a date range from today going back 2 days.
This is what I have so far;
export sjj_date=`date "+%Y/%m/%d"`
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 02:19 AM
08-03-2006 02:19 AM
Re: exporting date range
sjj_date=$(caljd.sh -S "/" -y $(caljd.sh -p 2))
export sjj_date
Invoke the attached script as caljd.sh -u for full usage and examples.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 02:36 AM
08-03-2006 02:36 AM
Re: exporting date range
sjj_date=$(perl -e '($mday,$mon,$year) = (localtime(time() - (2 * 86400))) [3,4,5]; printf("%04d/%02d/%02d",$year + 1900,$mon + 1,$mday)')
export sjj_date
(I think I got all of them "()'s" right.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 02:50 AM
08-03-2006 02:50 AM
Re: exporting date range
If all you want is 2-days ago, this will do:
# export sjj_date=`perl -MPOSIX=strftime -le 'print strftime "%Y/%m/%d",localtime(time-(86400*2))'`
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 03:01 AM
08-03-2006 03:01 AM
Re: exporting date range
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 03:18 AM
08-03-2006 03:18 AM
Re: exporting date range
Run this command:
UNIX95= ps -e -o comm,pid,etime
Notice that the etime (Elasped time) column changes its format when a process has been running for more than 24 hours. A little pattern matching (awk,perl) should get you the rest of the way. Man ps to understand what this is doing.
I am not going to solve your problem (maybe I just ain't smart enough to figure out how to do it or maybe I figure that it's more important that you learn how to do it, you decide) but anyway I hope that nobody helps more than this either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 03:50 AM
08-03-2006 03:50 AM
Re: exporting date range
I am assuming "jobs" means "unix processes."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 06:57 AM
08-03-2006 06:57 AM
Re: exporting date range
ps: illegal option -- o
usage: ps [-edaxzflP] [-u ulist] [-g glist] [-p plist] [-t tlist] [-R prmgroup] [-Z psetidlist]
I understand you are trying to format the output, but the command flag -o just does not seem to work for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 07:05 AM
08-03-2006 07:05 AM
Re: exporting date range
The UNIX95= is an important part of that command. It changes the behavior XPG4, which allows for different ps options and formatting.
The man page for ps should have more information on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 07:07 AM
08-03-2006 07:07 AM
Re: exporting date range
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2006 07:13 AM
08-03-2006 07:13 AM