Sponsored Content
Full Discussion: Date Range in UNIX
Top Forums Shell Programming and Scripting Date Range in UNIX Post 302761109 by adisky123 on Friday 25th of January 2013 05:46:58 AM
Old 01-25-2013
Date Range in UNIX

Hi Everyone How all are doing today,

Want some help from All in Unix, What I am trying to do is , A shell file should be a called with two date parameters suppose the shell file name is run.sh

run.sh <start_date> <end_date>
If end date is not given it will pick today's date. The date should be in format yyyy-mm-dd.

Now the twist is suppose I have given the dates
Code:
 run.sh 2012-01-01 2012-01-30

Inside this shell file It should pick the data range max of 6 days from start date like

at first hit the Start date and end date should be 2012-01-01 and 2012-01-07 #- 6days and print on the screen
at second hit the Start date and end date should be 2012-01-07 and 2012-01-13 #- 6days ..
.
.
.
.
at last hit the Start date and end date should be 2012-01-25 and 2012-01-30 #- 6days ..

I hope I am able to clear you
Thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cp only files in certain date range

hi all, I'm trying to do a cp only on files I created on a given day or within a certain date range. What's the best way to do this? Cheers, KL (1 Reply)
Discussion started by: ee7klt
1 Replies

2. Shell Programming and Scripting

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies

3. Programming

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies

4. UNIX for Advanced & Expert Users

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies

5. Shell Programming and Scripting

Get date range between 2 date input

Hi Experts, I have files name report_20090416 report_20090417 report_20090418 report_20090420 report_20090421 I have 2 input from user From Date: 20090417 To Date: 20090420 and I need to grep only those line in between. Output should be report_20090417 report_20090418... (3 Replies)
Discussion started by: tanit
3 Replies

6. UNIX Desktop Questions & Answers

date range

I have a number of instances wher I need to run reports for the previous month and need to include the last months date range in the sql. I want to create a string which consists of the first and last dates of last month separated with an ' and ' ie for this month (Feb) I want it to say '01/01/10... (3 Replies)
Discussion started by: Niven
3 Replies

7. Shell Programming and Scripting

Date Range Problem

Hi All, I have a log file which has first few characters of every line as a timestamp. 2010-06-01 04:56:02,802 DEBUG {Thread-27} Some text message 2010-06-01 04:56:02,802 DEBUG {Thread-27} Some text message 2010-06-01 04:56:02,802 DEBUG {Thread-27} Some text message 2010-06-01... (7 Replies)
Discussion started by: nitin14341
7 Replies

8. Shell Programming and Scripting

Date listing in a date range

Solaris 10 ksh88 Sorry for re-hashing some of this, but I can't find a proper solution in the forums. Starting with /a/archive containing (on and on date formatted directories) 20060313 20080518 20100725 20121015 20060314 20080519 ... (1 Reply)
Discussion started by: moesplace
1 Replies

9. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

10. Shell Programming and Scripting

Date range

Dear all, how can I select in the file below only the files created between Aug 14 2014 and Feb 03 2015? EZA2284I -rw-r--r-- 1 30 8 356954 Aug 15 2014 file1 EZA2284I -rw-rw-r-- 1 30 8 251396 Feb 05 12:53 file2 EZA2284I -rw-rw-r-- 1 30 8 ... (3 Replies)
Discussion started by: simomuc
3 Replies
DP(8)								     [nmh-1.5]								     DP(8)

NAME
dp - parse dates 822-style SYNOPSIS
/usr/lib/mh/dp [-form formatfile] [-format string] [-width columns] [-version] [-help] dates ... DESCRIPTION
Dp is a program that parses dates according to the ARPA Internet standard. It also understands many non-standard formats, such as those produced by TOPS-20 sites and some UNIX sites using ctime(3). It is useful for seeing how nmh will interpret a date. The dp program treats each argument as a single date, and prints the date out in the official 822-format. Hence, it is usually best to enclose each argument in quotes for the shell. To override the output format used by dp, the -format string or -format file switches are used. This permits individual fields of the address to be extracted with ease. The string is simply a format string and the file is simply a format file. See mh-format(5) for the details. Here is the default format string used by dp: %<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%> which says that if an error was detected, print the error, a `:', and the date in error. Otherwise, output the 822-proper format of the date. FILES
$HOME/.mh_profile The user profile PROFILE COMPONENTS
None SEE ALSO
ap(8), Standard for the Format of ARPA Internet Text Messages (RFC-822) DEFAULTS
`-format' default as described above `-width' default to the width of the terminal CONTEXT
None BUGS
The argument to the -format switch must be interpreted as a single token by the shell that invokes dp. Therefore, one must usually place the argument to this switch inside quotes. MH.6.8 11 June 2012 DP(8)
All times are GMT -4. The time now is 06:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy