Sponsored Content
Top Forums Shell Programming and Scripting How to print the specific part of the file name with file creation date? Post 303011441 by sadique.manzar on Thursday 18th of January 2018 09:24:03 AM
Old 01-18-2018
@RudiC:
Code:
MobileProtocol.20171228T083500.18575.udr
MobileProtocol.20171228T043000.9955.udr
MobileProtocol.20171228T230700.103907.udr
MobileProtocol.20171228T095500.21219.udr
MobileProtocol.20171228T130000.156953.udr
MobileProtocol.20171228T182400.15272.udr
MobileProtocol.20171228T182500.15273.udr
MobileProtocol.20171228T082000.29941.udr
MobileProtocol.20171228T081800.156671.udr
MobileProtocol.20171228T082000.156673.udr
MobileProtocol.20171228T081900.156672.udr
MobileProtocol.20171228T151500.10084.udr
MobileProtocol.20171228T065000.26870.udr
MobileProtocol.20171228T170200.60932.udr
MobileProtocol.20171228T165400.60924.udr
MobileProtocol.20171228T165700.60927.udr
MobileProtocol.20171228T235900.104040.udr
MobileProtocol.20171228T125800.60688.udr
MobileProtocol.20171228T130000.60690.udr
MobileProtocol.20171228T125900.60689.udr

when i adjust the value [0-9.]{14} like 14 to 12 13 i get results for different pattern like "20171224" "20171227" and so on so how could i predict this value in general. ?
---------- Post updated at 09:24 AM ---------- Previous update was at 09:20 AM ----------

Code:
find . -type f -name "MobileProtocol.20171228T*" -printf '%TY-%Tm-%Td %p\n' | sed -r 's/T[0-9.]{13}udr//; s/ .*\./ /;' | sort| uniq -cw10

 1590 2017-12-28 20171228
  499 2017-12-30 20171228
    1 2017-12-31 20171228
    1 2018-01-01 20171228
    1 2018-01-03 20171228
    2 2018-01-05 20171228
    2 2018-01-06 20171228
    3 2018-01-07 20171228
    1 2018-01-11 20171228


 find . -type f -name "MobileProtocol.20171224T*" -printf '%TY-%Tm-%Td %p\n' | sed -r 's/T[0-9.]{12}udr//; s/ .*\./ /;' | sort| uniq -cw10

     2 2017-12-23 20171224
  2124 2017-12-24 20171224
     1 2017-12-27 20171224
     2 2017-12-31 20171224

how will i predict {12}udr in case for files pattern.


Moderator's Comments:
Mod Comment Thanks for trying to use tags - but don't "overtag". Your own text goes untagged, QUOTE tags for text cited from other sources.

Last edited by RudiC; 01-18-2018 at 10:32 AM.. Reason: Removed or changed QUOTE to CODE tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

file creation date including seconds

Hi, Is anybody can help me to get the file creation date with seconds? -rw-r--r-- 1 opsc system 422550845 Aug 22 15:41 StatData.20020821 Thanks in advance Krishna (7 Replies)
Discussion started by: krishna
7 Replies

2. UNIX for Dummies Questions & Answers

file creation date & time

Hi All, I have some files which are creates every day using a script. I want to create a log files which does write "filename,creation day and time" how can I do this ?? Alice (3 Replies)
Discussion started by: alisevA3
3 Replies

3. UNIX for Dummies Questions & Answers

Changing Creation Date to a Prespecified Date of a File In Unix

Dear Expert, Is there a command to do that in Unix? In such a way that we don't need to actually "write" or modified the content. -- monkfan (4 Replies)
Discussion started by: monkfan
4 Replies

4. Shell Programming and Scripting

How to get File creation date.

Hi All, I need to get file creation date. I have to access one file who's name is like... abc.log092308 and the date changes as per current date. And i am accessing this file next day. meance in above case i will access above file on 09-24-2008 Also one problem is that this file... (2 Replies)
Discussion started by: Jeevan Salunke
2 Replies

5. Solaris

gzip a file and append creation date stamp to file

I want to gzip a file and append the creation date to the end of the file. How can I accomplish this task. Basically they are log files which need a creation date stamp appended to make sure they do not overwrite other log files. -jack (3 Replies)
Discussion started by: jacktravine
3 Replies

6. Shell Programming and Scripting

how to find creation date of file

Hi, I just need to know way of getting date of file when it was created. eg i have a file abc created on 23 aug. Now i need to know date of file i.e. 23 aug. How can i get that data. Thanks Sarbjit (7 Replies)
Discussion started by: sarbjit
7 Replies

7. Shell Programming and Scripting

finding creation date of a file

Hi, Can anyone tell me a process to find the creation date of a file in a directory. If suppose I have a file in a directory created in 2009 -rw-r--r-- 1 xyz guest 2480 Jul 16 2009 sample.txt The command should return the the file creation date as 16/07/2009 thanks, (2 Replies)
Discussion started by: swathich
2 Replies

8. Shell Programming and Scripting

Help with creating a text file in perl with file creation date.

Hi, I am quite new to Perl scripting and i need to create a .TXT file using perl, with fields (A,B,C,D,E), and this text file should be named with current file creation date "XYZ_CCYYMMDD.TXT" (i.e.XYZ_2011042514:33 PM). Can anyone who has done this, please share their expertise on this... (5 Replies)
Discussion started by: msrahman
5 Replies

9. Shell Programming and Scripting

[Solved] Printing a part of the last line of the specific part of a file

Hi, I have 80 large files, from which I want to get a specific value to run a Bash script. Firstly, I want to get the part of a file which contains this: Name =A xxxxxx yyyyyy zzzzzz aaaaaa bbbbbb Value = 57 This is necessary because in a file there are written more lines which... (6 Replies)
Discussion started by: wenclu
6 Replies

10. Shell Programming and Scripting

Script to print file name and its creation date

Hello , I am looking for a script to print file name and its last updated time. FILE CREATION-TIME FILE-NAME 24/10/2017 12:34 TDR-IU-8-2017.10.24.07:40:00-2017.10.24.07:45:00 when we run l command it print the directory and the files with details like permission,... (1 Reply)
Discussion started by: sadique.manzar
1 Replies
All times are GMT -4. The time now is 01:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy