Sponsored Content
Top Forums Shell Programming and Scripting Subtracting a date based on ls output Post 302993176 by drysdalk on Tuesday 7th of March 2017 11:32:35 AM
Old 03-07-2017
Hi,

The command:

find . -type f -mtime +7 -exec ls -l {} \;

will find all files underneath the current working directory that were last modified more than seven days ago and perform a long directory listing on them. So if that's what you're wanting, then this should absolutely do what you need.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

subtracting a days from current date

Hi i am trying to subtract days from current date. For example todays date is 10/03/2006. If i subtract 2 days it should give 8/03/2006. I am also trying to find the access date of a file in dd/mm/yyyy format. Can any one please help in how to do this. Ramesh (1 Reply)
Discussion started by: rameshspal
1 Replies

2. Shell Programming and Scripting

Subtracting date / timestamps

I have looked through the forums and found many date / time manipulation tools, but cannot seem to find something that fits my needs for the following. I have a log file with date time stamps like this: Jun 21 17:21:52 Jun 21 17:24:56 Jun 21 17:27:59 Jun 21 17:31:03 Jun 21 17:34:07 Jun... (0 Replies)
Discussion started by: roadcyclist
0 Replies

3. UNIX for Dummies Questions & Answers

adding or subtracting days in the o/p of date

how can we add or subtract days from the output of date command in unix... like if i want to subtract a day from the result of date command like this.. v_date=`date +%Y%m%d` this wud give me 20080519 now i want to subtract one day from this.. so tht it wud give me 20080518.. how do i do... (1 Reply)
Discussion started by: St.Fartatric
1 Replies

4. Shell Programming and Scripting

Getting date output based on time zone

Hi, We have a server in US and hence while the command "date" is given it gives the output in EDT. If I want the date output in MET, how can I get it. Please let me know how I could do it in the script which is ksh. Thanks. (1 Reply)
Discussion started by: jmathew99
1 Replies

5. UNIX for Dummies Questions & Answers

Static date adding and subtracting years

Hi Gurus! I have a static date in a YYYYMMDD format; and I want get the date 2 years in the past and 2 years in the future. static_date=20010203 old_date=$static_date - 3 years future_date=$static_date + 2 years I was only able to research on dates that are current and not on static... (3 Replies)
Discussion started by: kokoro
3 Replies

6. Shell Programming and Scripting

SQL one liner for subtracting 1 from date

I got a statement like below to subtract 1 from given date using teradata. I am looking for a one line unix command to perform the same. select 'parse_this_record', (DATE '${FILE_DATE}' - 1) (FORMAT 'YYYY-MM-DD'); Input: 2012-02-21 Expected Output: 2012-02-20 PS: One liner because I am... (2 Replies)
Discussion started by: siteregsam
2 Replies

7. Shell Programming and Scripting

Adding/ Subtracting from Date

Hi , How can I add/substruct x number of days with date? For example My_Date=`date` Now I need Hope it's clear. (2 Replies)
Discussion started by: Anupam_Halder
2 Replies

8. UNIX for Dummies Questions & Answers

Subtracting number of days from current date

Hi All, I am using KSH shell and need to subtract n number of days from the current date .. kindly suggest ! Thanks in advance!:) (20 Replies)
Discussion started by: dev.devil.1983
20 Replies

9. Shell Programming and Scripting

Subtracting months from passed Date

Hi All, I am getting a date from environment variable and want to do some processing by subtracting 2 months from the date passed through the environment variable. I am trying the following syntax : date_var=2014-08-31 date_2M_ago='$date_var+"%d%m%y" --$date_var="2 months ago" '... (3 Replies)
Discussion started by: Rahul Raj
3 Replies

10. UNIX for Beginners Questions & Answers

Changing CSV files with date . Subtracting date by values

Hi All, I have a CSV file which is as below. Basically I need to take the year column in it and find if the year is >= 20152 . If that is then I should subtract all values by 6. In the below example in description I am having number mentioned as YYWW so I need to subtract those by -5. Whereever... (8 Replies)
Discussion started by: arunkumar_mca
8 Replies
ckdate(1)							   User Commands							 ckdate(1)

NAME
ckdate, errdate, helpdate, valdate - prompts for and validates a date SYNOPSIS
ckdate [-Q] [-W width] [-f format] [-d default] [-h help] [-e error] [-p prompt] [-k pid [-s signal]] /usr/sadm/bin/errdate [-W width] [-e error] [-f format] /usr/sadm/bin/helpdate [-W width] [-h help] [-f format] /usr/sadm/bin/valdate [-f format] input DESCRIPTION
The ckdate utility prompts a user and validates the response. It defines, among other things, a prompt message whose response should be a date, text for help and error messages, and a default value (which will be returned if the user responds with a RETURN). The user response must match the defined format for a date. All messages are limited in length to 70 characters and are formatted automatically. Any white space used in the definition (including new- line) is stripped. The -W option cancels the automatic formatting. When a tilde is placed at the beginning or end of a message definition, the default text will be inserted at that point, allowing both custom text and the default text to be displayed. If the prompt, help or error message is not defined, the default message (as defined under NOTES) will be displayed. Three visual tool modules are linked to the ckdate command. They are errdate (which formats and displays an error message), helpdate (which formats and displays a help message), and valdate (which validates a response). These modules should be used in conjunction with FML objects. In this instance, the FML object defines the prompt. When format is defined in the errdate and helpdate modules, the messages will describe the expected format. OPTIONS
The following options are supported: -d default Defines the default value as default. The default does not have to meet the format criteria. -e error Defines the error message as error. -f format Specifies the format against which the input will be verified. Possible formats and their definitions are: %b = abbreviated month name (jan, feb, mar) %B = full month name %d = day of month (01 - 31) %D = date as %m/%d/%y (the default format) %e = day of month (1 - 31; single digits are preceded by a blank) %h = abbreviated month name, identical to %b% %m = month number (01 - 12) %y = year within century (for instance, 89) %Y = year as CCYY (for instance, 1989) -h help Defines the help messages as help. -k pid Specifies that process ID pid is to be sent a signal if the user chooses to abort. -p prompt Defines the prompt message as prompt. -Q Specifies that quit will not be allowed as a valid response. -s signal Specifies that the process ID pid defined with the -k option is to be sent signal signal when quit is chosen. If no signal is specified, SIGTERM is used. -W width Specifies that prompt, help and error messages will be formatted to a line length of width. OPERANDS
The following operand is supported: input Input to be verified against format criteria. EXIT STATUS
The following exit values are returned: 0 Successful execution. 1 EOF on input, or negative width on -W option, or usage error. 3 User termination (quit). 4 Garbled format argument. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) NOTES
The default prompt for ckdate is: Enter the date [?,q]: The default error message is: ERROR - Please enter a date. Format is <format>. The default help message is: Please enter a date. Format is <format>. When the quit option is chosen (and allowed), q is returned along with the return code 3. The valdate module will not produce any output. It returns zero for success and non-zero for failure. SunOS 5.11 14 Sep 1992 ckdate(1)
All times are GMT -4. The time now is 01:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy