Sponsored Content
Top Forums Shell Programming and Scripting Get the newest files based on date Post 302338348 by Beginer0705 on Monday 27th of July 2009 03:45:37 PM
Old 07-27-2009
I need to get **a group of latest files** based on date.

Thanks for responding.

---------- Post updated at 02:45 PM ---------- Previous update was at 02:41 PM ----------

For example, I need to get all of these files based on the latest/new date


Jul 27 19:38 TESTPWD_10204_file_77kgu17l_19687_1
Jul 27 19:40 TESTPWD_10204_file_7akgu17p_19690_1
Jul 27 19:59 TESTPWD_10204_file_79kgu17l_19689_2
Jul 27 20:05 TESTPWD_10204_file_7dkgu3ba_19693_1
Jul 27 20:11 TESTPWD_10204_file_7ckgu344_19692_1
Jul 27 20:22 Config_TESTPWD_10204_060609:19:10.TXT
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remove files based on date

I am trying to write a shell script that will remove files in a directory based on the date. For instance, remove all files older than yesterday. Any ideas? (4 Replies)
Discussion started by: hshapiro
4 Replies

2. Shell Programming and Scripting

Count of files based on date?

Hi Friends, Can anyone help me with this: To get the count of files that are existing in a directory created on a perticular date like in the example (01/08) .(having same pattern for the filename) ex: FileName Creted Date FILE001 01/08/2007 FILE005 ... (6 Replies)
Discussion started by: sbasetty
6 Replies

3. Shell Programming and Scripting

Copy files based on date

Hi all i am having so many files in my directory.Is there any option to copy files based on date. example i am having file this -rw-rw-r-- 1 ram user 1 Feb 2 17:12 abc -rw-rw-r-- 1 ram user 1 Feb 2 17:12 bnw -rwxrwxr-x 1 ram user 21122 Feb 4... (3 Replies)
Discussion started by: suryanarayana
3 Replies

4. Shell Programming and Scripting

Deleting the files based on the date's

I have to write one script which will delete the files in the below passion. If today is 17-Feb-2010 then the script delete only 17-JAN-2010 files from the directory. Could you please help me, How will I delete the files when the year is leap year, if today is 30th Mar 2010 then how will... (1 Reply)
Discussion started by: kandi.reddy
1 Replies

5. UNIX for Dummies Questions & Answers

Remove files based on date

Hello team, I have a number of files in a folder which are dated yesterday and today.Can i remove all the files which i created today based on date?? is there any syntax for this ?? (1 Reply)
Discussion started by: kanakaraju
1 Replies

6. Shell Programming and Scripting

finding the files based on date..

Hi to every one , i had ascenario like this.. i had path like export/home/pmutv/test/ in this i will recive 43 files daily with each file having that days date i.e like product.sh.20110512 like this i will 43 files every day i had to find the files. if files are avaliable i... (2 Replies)
Discussion started by: apple2685
2 Replies

7. 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

8. Shell Programming and Scripting

Find file by filename or with newest modified date

Hi, I have a directory that has numerous files in it, and there is two which are named "filerec_ddmmyyHH24MMSS" by the time they are created so "filerec_010615012250" was created at 01:22:50 on 1st June 2015. I need to find the most recently created of those 2 files and get the contents of... (4 Replies)
Discussion started by: finn
4 Replies

9. Shell Programming and Scripting

Delete all but 3 newest files

This is related to my post on backup up files. I really appreciate all the help too. :-) I would like to delete all but the 3 newest files in my backup directory. /media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/ For example Ubuntu_Documents.zip_09Aug2018_12_00... (2 Replies)
Discussion started by: drew77
2 Replies

10. UNIX for Beginners Questions & Answers

Find the files based on date from filelist

Hi All, I have a filelist which contains the "ls" output, i want to extract the filenames written in this files based on date. I know i can run loop and extract the file but i want to avoid it. also there is find command which can be used on directory i.e. find . -type f -newermt "2019-09-25"... (3 Replies)
Discussion started by: kumarinfa
3 Replies
acctcon(8)						      System Manager's Manual							acctcon(8)

NAME
acctcon1, acctcon2 - Display connect-time accounting summaries SYNOPSIS
acctcon1 [-l file] [-o file] [-p] [-t] acctcon2 FLAGS
Writes line-usage format from the input file (usually /var/adm/wtmp) to file for the accounting period during which the file /var/adm/wtmp is active. The following example shows the ASCII line-usage heading format: TOTAL DURATION: 57 MINUTES LINE MINUTES PERCENT # SESS # ON # OFF pty/ttyp4 37 64 3 3 7 console 26 45 2 2 4 pty/ttyp5 7 11 1 1 3 pty/ttyp6 0 0 0 0 2 TOTALS 69 - 6 6 16 TOTAL DURATION specifies the total number of minutes used for connect sessions during the accounting period during which the /var/adm/wtmp file is active. The columns specify the line name, the number of session minutes used, the percentage of total elapsed time used for the sessions, the number of sessions charged, the number of logins, and the number of logouts. The last line in the line-usage file totals the entries for each column. The line-usage format helps to track line usage and identify bad lines. All hangups, terminations of the login command, and termi- nations of the login shell cause the system to write logout records, so that the number of logouts is often greater than the number of sessions. Writes an overall-record format to file from the input file (usually /var/adm/wtmp) for the accounting period during which the /var/adm/wtmp file is active. The following example shows the overall-record format: from mon day date hh:mm:ss yyyy tz to mon day date hh:mm:ss yyyy tz 2 date changes Number of times the date was changed. 21 acctg off Number of times accounting functions were turned off. 25 run-level S Number of times accounting functions ran in single-user mode. 108 system boot Number of times the system was rebooted. 21 acctg on Number of times accounting functions were turned on. 21 acctcon1 Number of times the acctcon1 command was issued. The first lines specify the date and time stamp, including time zone, of the accounting period start time and end time. Writes the input file (usually /var/adm/wtmp) to the default output device. For example: pty/ttyp1 hoff 616883748 Jul 19 16:35:48 1990 EST pty/ttyp1 hoff 616883825 Jul 19 16:37:05 1990 EST pty/ttyp1 LOGIN 616883833 Jul 19 16:37:13 1990 EST pty/ttyp1 tom 616883837 Jul 19 16:37:17 1990 EST The output columnar format lists the line reference name, the login name, the time in seconds since January 1, 1970, 0 hours, 0 min- utes, 0 seconds, the date, the 24-hour clock time, the year, and the time zone. Uses the last time found in the input file as the ending time for any current processes. This time, rather than current time, is necessary to have reasonable and repeatable values for noncurrent files. The output format is the same as the default output format. The acctcon1 command also maintains a list of ports on which users are logged in. When the acctcon1 command reaches the end of its input, a session record is written for each port that still appears to be active. The acctcon1 command assumes that the input source is the current file and uses current time as the ending time for each session still in progress. DESCRIPTION
The acctcon1 and acctcon2 commands are described separately. acctcon1 The acctcon1 command is invoked by the runacct shell procedure to write a sequence of login and logout records. One record for each con- nect session is written to the specified destination as a sequence of login session records. The /var/adm/wtmp source file should be directed as input to the command. The following example shows the default ASCII columnar output format: 285212673 1192 hoff 85 0 616883748 Jul 19 16:35:48 1990 EST 285212673 1033 tom 10 0 616883837 Jul 19 16:37:17 1990 EST 285212673 0 root 1345 2852 616883855 Jul 19 16:37:35 1990 EST 285212673 1120 jim 0 62 616888058 Jul 19 17:47:38 1990 EST The columns contain the following information: Device address, expressed as a decimal equivalent of the major/minor device address at which the connection was activated. User ID assigned for the connect-session record. Login name under which the session took place. Total num- ber of prime-time seconds for the connect session. Total number of nonprime-time seconds for the connect session. Seconds since the date 0 hours, 0 minutes 0 seconds, 1 January 1970. Month, day of the month, connect-session starting time, year, and time zone. The order of date and time information is locale dependent. The timestamps shown use the default format for date and time values; however, you can define the NLTIME environment variable to change this format. acctcon2 The acctcon2 command is invoked by the runacct shell procedure. It converts a sequence of login session records produced by the acctcon1 command into connect-time total accounting records. These records are often merged with other total accounting records with the acctmerg command to produce a daily report. EXAMPLES
The following example converts login records to a default format login session record report: acctcon1 -t /var/adm/lineuse -o /var/adm/reboots < /var/adm/wtmp > /var/adm/logsess The previous example generates three files. The /var/adm/logsess file lists ending date and 24-hour timestamp records that correspond with the last time that input was obtained with the -t flag. For the accounting period covered by the /var/adm/wtmp file, the /var/adm/lineuse line-usage summary file is generated by the -l flag, and the /var/adm/reboots overall record file is obtained with the -o flag. The following example converts a series of login session records in the /var/adm/logsess file to a total accounting record in the /var/adm/logacct binary file: acctcon2 < /var/adm/logsess > /var/adm/logacct FILES
Specifies command path. Specifies command path. The active login/logout database file. Accounting header files that define formats for writing accounting files. RELATED INFORMATION
Commands: login(1), acct(8), acctmerg(8), fwtmp(8), init(8), wtmpconvert(8). Functions: acct(2). delim off acctcon(8)
All times are GMT -4. The time now is 08:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy