Sponsored Content
Full Discussion: Date issue
Top Forums UNIX for Beginners Questions & Answers Date issue Post 303039296 by vedanta on Sunday 29th of September 2019 05:25:07 PM
Old 09-29-2019
I have made some correction. Please let me know if there is a better way to do it.


Code:
unset date_to
unset date_from
unset counter=15
date_to=$(date -d 2018-06-15 +"%Y%m%d")    
todate=$(date -d 2018-08-18 +"%Y%m%d")  
counter=0
while [ $date_to -lt $todate ]; #put the loop where you need it
do
 date_from=$(date -d "$date_to +1 days" '+%Y%m%d') 
 date_to=$(date -d "$date_from +$counter days" '+%Y%m%d')
 echo "date from"$date_from
 echo "date to" $date_to 
 ls -lrt $(find . -type f -newermt $date_from \! -newermt $date_to )
done

 

10 More Discussions You Might Find Interesting

1. Programming

date issue

hi all: I want to create a new file dynamically for each day.how can i do this. eg.. struct tm tm; while(1) { if(tm.tm_hr==0 && tm.tm_min=0 && tm.tm_sec==0) { //create a new file.. ... (3 Replies)
Discussion started by: bankpro
3 Replies

2. UNIX for Advanced & Expert Users

date issue-find prevoius date in a patricular format

Hi , I have written a shell script that takes the current date on the server and stores it in a file. echo get /usr/home/data-`date '+%Y%d'`.xml> /usr/local/sandeep/GetFILE.ini I call this GetFILE.ini file from an sftp program to fetch a file from /usr/home/ as location. The file is in... (3 Replies)
Discussion started by: bsandeep_80
3 Replies

3. Shell Programming and Scripting

Simple date issue

Hi all, i have used the search already before someone shouts at me and i have seen the 'datecalc' program but this is not working correctly for me in the shell and environment i am using. I am using solaris 10 and bourne shell. I have two dates '07-04-2009' and '05-05-2009'. I just need to... (2 Replies)
Discussion started by: muay_tb
2 Replies

4. Solaris

Cron Date issue

Hi, We have Solaris10.2.3 server. If we execute command `date` on Command Line Promt it shows time - >Tue Jun 23 11:35:55 BST 2009 - which is correct However if the command is executed through cron it gives - >Tue Jun 23 10:35:55 ESTEDT 2009 - which is wrong Request you to help me in... (1 Reply)
Discussion started by: sk2304
1 Replies

5. Shell Programming and Scripting

sort date issue

Hi Everyone, # cat b Sat 12 Sep 2009 10:31:49 PM MYT;a;a;a;Sun 13 Sep 2009 11:32:49 AM MYT; Sat 13 Sep 2009 10:31:49 PM MYT;a;a;a;Mon 14 Sep 2009 10:31:49 PM MYT; Sat 14 Sep 2009 10:31:49 PM MYT;a;a;a;Sun 13 Sep 2009 10:31:49 PM MYT; # sort -t';' -k5 b Sat 13 Sep 2009 10:31:49 PM... (8 Replies)
Discussion started by: jimmy_y
8 Replies

6. Shell Programming and Scripting

Date issue

Hi I need to write a shell script (bash) that takes a date as an in-parameter an decides if its winter or summer time. I have diffrent dates like 20150112 , 200901028 , 200100605 etc. The rule for winter/summer time is : Summer time spans between the last Sunday in march 02:00 to the... (2 Replies)
Discussion started by: duffnix
2 Replies

7. Shell Programming and Scripting

date printing issue

Hello folks Below command shows current date echo `date +%Y-%m-%d` 2010-04-21 How to show one day old date, i want see like 2010-04-20 (1 Reply)
Discussion started by: learnbash
1 Replies

8. Shell Programming and Scripting

Date related issue

Hi, I have TDATE=$(date '+%b %d') That stores "Sep 01" in the TDATE. How I can store "Sep 1"? Thanks in advance (3 Replies)
Discussion started by: dipeshvshah
3 Replies

9. Shell Programming and Scripting

Simple date issue

Hi , Here is the smaller version of the problem. Working individually as command ************************>echo $SHELL /bin/bash ************************>TO_DAY=`date` ************************>echo $TO_DAY Tue Jul 16 02:28:31 EDT 2013 ************************> Not working when... (5 Replies)
Discussion started by: Anupam_Halder
5 Replies

10. Shell Programming and Scripting

Date issue

I have posted a code last week about that date format problem, well I have figured out a much lesser coding. #!/usr/bin/bash clear export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 if ; then echo " Incorrect Number of Arguments"; echo " Usage : Main_Script <FROM_DATE>... (1 Reply)
Discussion started by: Chandan_Bose
1 Replies
clipf(1)						      General Commands Manual							  clipf(1)

NAME
clipf - Personal finance manager with command line interface SYNOPSYS
clipf [<conf_dir>] DESCRIPTION
Simple personal finance manager, allow to track Your incomes/expences by accounts and hierarchical categories. Store all data in flat text files. ARGUMENTS
<conf_dir> Directory with configuration file and data files. Default to ~/.clipf/. If there is no such directory found at program startup, it would be created and populated by default configuration and empty data files. DEFINITIONS
account - describe independent money storage, for which You want to track remains and turnover. item - describe categories of Your incomes/expences. Can be nested as files/directories in file system. item code - it is segmented unique identifier of item/item group. Period "." in item code define nesting levels. Period at the end of item code describe, that this item is group (have subling items). operation - define single money transaction (income or expense). tag - arbitrary string, used for additional classification of operations. Have the same nesting rules as items. Any number of tags can be added to each operation. It may be good idea to store available tags in item list. USAGE
Type help to see available commands. Type help <command> to see online help about particular <command>. For most reporting commands, output can be piped to external shell command the same way, as shell do. COMMANDS CONCERNING ITEMS
prod add [-d] <item_code> <item_name> Add new item. Type <item_name> in quotes, if it contain spaces. -d - define this item as income (default to expence). prod rm <item_code_prefix> Remove all items, which code starts with <item_code_prefix>. This don't affect the operations list. prod ls [<item_code>] Show one level of item list - direct sublings of <item_code>. Default to root level. prod mv <old_item_code_prefix> <new_item_code_prefix> Update all item codes, which starts with <old_item_code_prefix>, replacing it to <new_item_code_prefix>. Item codes in operation list would be updated as well. COMMANDS CONCERNING OPERATIONS
op add [-d <date>] [-a <account>] [-t <tag>] <item_code> <amount> [<note>] Add new operation -d <date> - override default operation date to <date>. -a <account> - override defaut operation account to <account> -t <tag> - label operation with <tag>. Any number of -t options can be used to add several tags to operation. op ls [-t <tag_prefix>] [<item_code_prefix>] Show list of operations in current reporting period. If <item_code_prefix> specified, list would be limited by the operations, which item code starts with <item_code_prefix>. If '-t <tag_prefix>' option specified, limit output with operations, labelled with tag, starts with <tag_prefix> COMMANDS CONCERNING REPORTING
Reporting period is always between <date_from> and <date_to> global options, which You set by set command. rep prod [-t <tag_prefix>] [-a <account>] [<item_code>] Show turnover report for items (item groups), which are direct subling of <item_code> (default to root). Turnover for item group is summ of turnovers of all their nested items/groups. -t <tag_prefix> take into account only operations, labelled with tag, starts with <tag_prefix> -a <account> take into account only operations by <account> account. rep acc Show remains and turnovers for all accounts. OTHER COMMANDS
set <option> <value> Set global option <option> value to <value>. For date options, base format is Y-M-D. Leading 0 can be ommited. For the current year, year part can be ommited. For current month, year and month parts can be ommited. Available options: date - default date for new operations. Can be overriden by -d option of "op add". date_from date_to - reporting period for "op ls" and all "rep" subcommands. acc - default account for new operations. Can be overriden by -a option of "op add". max_lines - if number of lines in report output exceed this value, then "less" would be used to show report output. show [<option>] Show current values of all global options or specified <option>. calc <expression> Embedded calculator. Evaluate numeric expression and print the result. ALIASES
Aliases is the simple way to make shortcuts for frequently used commands. Alias can be defined by the pair of strings: <command_line_pre- fix> and <prefix_substitution_string>. If command line starts with any of the defined aliases <command_line_prefix>, this prefix would be substituted with corresponding <prefix_substitution_string>. Examples can be found in system configuration file (see FILES ). EXAMPLES
set date_from 2008-04-01 - set reporting start period to 2008-04-01. r prod - show turnover report by top level items. op ls | grep foo | less pipe report output to shell command. op ls | cat - >somefile.txt save report output to file FILES
All configuration files have the same format - plain python code, that would be executed during clipf startup, in the context of main mod- ule. More specific configuration file can overwrite settings from more general one. /etc/clipf.conf system-wide configuration file ~/.clipf.conf user-specific configuration <config_path>/clipf.conf configuration-specific settings. ~/.clipf/ Default configuration directory. Contain clipf.conf configuration file, and db/ subdirectory with data files. AUTHOR
Denis Galtsev <galtsevdv@gmail.com> SEE ALSO
Program site at: http://code.google.com/p/clipf/ clipf(1)
All times are GMT -4. The time now is 09:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy