Extract Date part from the filename


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Extract Date part from the filename
# 8  
Old 04-01-2014
Try also (pure shell):
Code:
X=$(ls -t |head -1)
X=${X%.*}
variable=${X#${X%????}}

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Extract date and time part from filename

Hi, I am facing one scenario in which I need to extract exact position of date and time from the name of the files. For example, Below is the record in which I need to extract position of YYYYMMDD,HHMISS and YYMMDD. Date and time variables can come more than once. I need to use these position... (13 Replies)
Discussion started by: Prathmesh
13 Replies

2. UNIX for Beginners Questions & Answers

How to extract date and time from filename?

Hi, I'm totally new in sell script and working with a shell code. I want to extract the date and time from the filenames. The filenames are different but all of them begins with WI_ SCOPE_: WI_SCOPE_DATA_CHANGE_2017-09-12_15-30-40.txt WI_SCOPE_BACK_COMPLETE_QUEUE_2017-09-12_15-31-40.txt... (5 Replies)
Discussion started by: Home
5 Replies

3. Shell Programming and Scripting

Finding the part of a filename

Hi, I am writing an ebuild for Gentoo Linux operating system. Writing an ebuild is about Bash scripting where I am a newbie. So, my ebuild must find a part of a specific filename. Such a filaname my look like this: libvclient_release_x64.so.740and I must to find the number at the and of... (18 Replies)
Discussion started by: csanyipal
18 Replies

4. Shell Programming and Scripting

Extract a part of a filename containing a particular word

Hi All, Thanks in Advance Shell Script or Perl Script I am working on a shell script. I need some assistance. My Requirement: 1) There are some set of files in a directory like given below OTP_UFSC_20120530000000_acc.csv OTP_UFSC_20120530000000_faf.csv... (7 Replies)
Discussion started by: aealexanderraj
7 Replies

5. Programming

to extract all the part of the filename before a particular word in the filename

Hi All, Thanks in Advance I am working on a shell script. I need some assistance. My code: if then set "subscriber" "promplan" "mapping" "dedicatedaccount" "faflistSub" "faflistAcc" "accumulator"\ "pam_account"; for i in 1 2 3 4 5 6 7 8;... (0 Replies)
Discussion started by: aealexanderraj
0 Replies

6. UNIX for Dummies Questions & Answers

to extract all the part of the filename before a particular word in the filename

Hi All, Thanks in Advance I am working on a shell script. I need some assistance. My Requirement: 1) There are some set of files in a directory like given below OTP_UFSC_20120530000000_acc.csv OTP_UFSC_20120530000000_faf.csv OTP_UFSC_20120530000000_prom.csv... (0 Replies)
Discussion started by: aealexanderraj
0 Replies

7. Shell Programming and Scripting

Getting part of a filename

Hi All, I'm trying to get part of a filename and my skill with regular expression are lacking. I know I need to use SED but have no idea how to use it. I'm hoping that someone can help me out. The file names would be: prefix<partwewant>suffix.extension the prefix and suffix are always 3... (4 Replies)
Discussion started by: imonkey
4 Replies

8. Shell Programming and Scripting

Extract date from filename and set timestamp

I have lots of files in this format: dvgrab-2003.06.29_15-30-24.mpg The numbers represents the date and time (YYYY.MM.DD_HH-MM-SS) How can I extract the dates from the filenames, and use the dates in the file timestamp? I guess this can be done by using "find", "sed" and "touch"? Can... (6 Replies)
Discussion started by: qwerty1234
6 Replies

9. Shell Programming and Scripting

Extract date from filename and create a new file

Hi, i have a filename CRED20102009.txt in a server 20102009 is the date of the file ddmmaaaa format the complete route is /dprod/informatica/Fuentes/CRED20102009.csv i want to extract the date to create a new file named Parameters.txt I need to create Parameters.txt with this... (6 Replies)
Discussion started by: angel1001
6 Replies

10. Shell Programming and Scripting

part of a filename

Hi, I need to extract only a part of the filenames of some files. The files are named this way : .tap_profile_SIT02 I want the "SIT02" part, which is not the same for each file. I was able to get what I want with bash, but not with ksh. Here is the command I used in bash : find... (8 Replies)
Discussion started by: flame_eagle
8 Replies
Login or Register to Ask a Question
Pod::Index::Entry(3pm)					User Contributed Perl Documentation				    Pod::Index::Entry(3pm)

NAME
Pod::Index::Entry - Represents Pod search result SYNOPSIS
use Pod::Index::Entry; my $entry = Pod::Index::Entry->new( keyword => 'constructors', podname => 'perlobj', line => 42, filename => '/usr/lib/perl5/5.8.7/pod/perlobj.pod', context => 'Using POD', ); # trivial accessors my $podname = $entry->podname; my $filename = $entry->filename; my $line = $entry->line; my $context = $entry->context; my $keyword = $entry->keyword; # extract the POD for this entry my $pod = $entry->pod; DESCRIPTION
This class represents a POD index entry. An entry is defined by the podname/filename, line number, and context. The entry object also has the ability to extract the POD "scope" from the filename. METHODS
new my $q = Pod::Index::Entry->new(%args); Create a new search object. Possible arguments are: podname The name of the pod, such as . filename The filename for the pod, such as Data/Dumper.pm. line The line number where the scope of this entry begins. context The title of the section that contains this entry. podname filename line context These are just simple accessors that return the value of these properties, as given to the constructor. pod Extracts the POD for the scope of the entry from $self->filename, beginning at $self->line. For a definition of scope, see Pod::Index. The POD extraction is delegated to the Pod::Index::Extract module. VERSION
0.14 SEE ALSO
Pod::Index, Pod::Index::Search, Pod::Index::Extract AUTHOR
Ivan Tubert-Brohman <itub@cpan.org> COPYRIGHT
Copyright (c) 2005 Ivan Tubert-Brohman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2005-10-16 Pod::Index::Entry(3pm)