Sponsored Content
Top Forums Shell Programming and Scripting Find the latest file based on the date in the filename Post 302854743 by rudoraj on Wednesday 18th of September 2013 09:36:31 AM
Old 09-18-2013
Find the latest file based on the date in the filename

Hi,

We've a list of files that gets created on a weekly basis and it has got a date and time embedded to it. Below are the examples. I want to find out how to get the latest files get the date and time stamp out of it.

Files are
PQR123.PLL.M989898.201308012254.gpg
PQR123.PLL.M989898.201308081254.gpg
PQR123.PLL.M989898.201308151554.gpg
PQR123.PLL.M989898.201308221454.gpg
PQR123.PLL.M989898.201308291354.gpg

So from the above files PQR123.PLL.M989898.201308291354.gpg is latest file since it was sent on August 29 at 1:54 pm. I need to get the date and timestamp of it which is "201308291354". Naming convention of the file always remains the same except 4th field is DATE AND TIME.

Need to use an awk command to get it.

Thanks,
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find filename based on file content

:confused: There is a flat file on my system which contains email addreses of people in my company. This file is utilized when sending notifications for various things. However nobody knows where this file is located or what it is named. The only thing we know is the email address of a user who... (4 Replies)
Discussion started by: kollerj
4 Replies

2. UNIX for Dummies Questions & Answers

get the latest file by reading the date in the filename.

Hi, I grep for a pattern in a list of files. "grep -i -l $pattern *.datx*" it may give me n number of files. say for eg, it gives me 2 files. lock_eicu_20071228_00000000.dat_20071228_05343100 lock_eicu_20080501_00000000.dat_20080501_05343900 out of these 2 files I need to get the... (7 Replies)
Discussion started by: prsshini
7 Replies

3. Shell Programming and Scripting

grep latest file based on date.

hi all, not sure if this has been posted b4 but i try to search but not valid. this is my question: when i do a ls -ltr there will be a list generated as follows: -rw-r--r-- 1 root sys 923260 Jan 10 04:38 FilePolling.41025.083TL021.xml -rw-r--r-- 1 root sys 1761337 Jan 10 04:40... (12 Replies)
Discussion started by: lweegp
12 Replies

4. Shell Programming and Scripting

How to FTP the latest file, based on date, from a remote server through a shell script?

How to FTP the latest file, based on date, from a remote server through a shell script? I have four files to be FTP'ed from remote server. They are of the following format. build1_runtime_mmddyyyy.txt build2_runtime_mmddyyyy.txt build3_runtime_mmddyyyy.txt buifile_count_mmddyyyy.txt ... (9 Replies)
Discussion started by: imran_affu
9 Replies

5. Shell Programming and Scripting

Get the oldest date based on date in the filename

I am using ksh93 on Solaris. Ok, this may seem like a simple request at first. I have a directory that contains sets of files with a YYYYMMDD component to the name, along with other files of different filespecs. something like this: 20110501_1.dat 20110501_2.dat 20110501_3.dat... (2 Replies)
Discussion started by: gary_w
2 Replies

6. Shell Programming and Scripting

Find file that matches today's date in filename and move to /tmp in bash

I'm having problems with my bash script. I would like to find a file matching today's date in the filename, i.e. my_file_20120902.txt and then move it to a different directory, i.e. /tmp. Thanks. (1 Reply)
Discussion started by: jamesi
1 Replies

7. Shell Programming and Scripting

Needed shell script to get the latest file based on date

hi i need the shell script to get the file with latest date. for example in my input folder i have files like file_20130212.txt file_20130211.txt now my output folder should have the file with latest date i.e..file_20120212.txt i want to get the latest file .. i.e is should take... (6 Replies)
Discussion started by: hemanthsaikumar
6 Replies

8. Shell Programming and Scripting

Find latest date in folder

HI I have folder in home dir. /home/kpp/07222013 /home/kpp/07212013 /home/kpp/07202013 Output :-- /home/kpp/07222013 Just find latest date (5 Replies)
Discussion started by: pareshkp
5 Replies

9. UNIX for Dummies Questions & Answers

How to find a file based on pattern & return the filename if found?

Hi all, I am a newbie here. I have this requirement to find a file based on a pattern then return the filename if found. I created a script based on online tutorials. Though, I am stuck & really appreciate if anyone can have a quick look & point me to the right direction? #Script starts... (10 Replies)
Discussion started by: buster_t
10 Replies

10. 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
JETRING(7)							 jetring commands							JETRING(7)

NAME
jetring - maintenance of gpg keyrings using changesets OVERVIEW
jetring is a collection of tools that allow for gpg keyrings to be maintained using changesets. It was developed with the Debian keyring in mind, and aims to solve the problem that a gpg keyring is a binary blob that's hard for multiple people to collaboratively edit. With jetring, changesets can be submitted, reviewed to see exactly what they will do, applied, and used to build a keyring. The origin of every change made to the keyring is available for auditing, and gpg signatures can be used to further secure things. OPERATION
A jetring directory is used as the "source" that a keyring is built from. To convert an existing gpg keyring to such a directory, use the jetring-explode(1) command. Each change to the gpg keyring is stored in a separate changeset file in the directory. Changesets can reflect any set of changes to the keyring. Changesets can also include arbitrary metadata. The jetring-gen(1) command can be used to compare two keyrings and generate a changeset from one to the other. Changesets are never removed or modified, only new ones added, using the jetring-accept(1) command. There's an ordering of the changesets. This ordering is stored in an index file. The index file is only appended to, to add new changesets. Changesets can be fully examined to see what change they make before applying them. The jetring-review(1) and jetring-diff(1) commands can be used for such review. To create a new keyring, or incrementally update an existing keyring, changesets are applied in order using the jetring-build(1) command. GPG SIGNATURES
The index file can optionally be gpg signed (the signature will be stored in index.gpg); if JETRING_SIGN is set to point to a gpg keyring, then jetring commands that operate on the jetring directory will always check that the index file is signed with one of the keys from that keyring. Commands that modify the index file will update its signature. CHANGESET FORMAT
A changeset file consists of one or more stanzas, separated by blank lines. The stanzas are in RFC-822-like format. Each stanza must have an action field, which specifies which action to take on the keyring, and a data field, typically a multi-line field, which contains the data to feed to the action. Supported actions are: import The data field should be an ascii-armored gpg key block, that is fed into gpg --import. edit-key keyid gpg --edit-key is run on the specified key id. The data field is a script, each line in it is passed in to gpg, the same as if gpg were being driven interactively. This can be used to make arbitrary changes to the key. delete-key keyid The given key is deleted. The data is fed into gpg --delete-key, and should be "y", since gpg expects that confirmation to deleting a key. Other fields can be added as desired to hold metadata about the change. Typical additional fields include date, changed-by, and comment. Changesets can be optionally have attached signatures, although such data is not automatically validated and is mostly useful to record who submitted or signed off on a given changeset. AUTHOR
Joey Hess, <joey@kitenet.net>. JETRING(7)
All times are GMT -4. The time now is 06:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy