Sponsored Content
Top Forums Shell Programming and Scripting Date format to be changed from DDMMYYYY to YYYYMMDD Post 302779021 by djrulz123 on Tuesday 12th of March 2013 03:57:22 AM
Old 03-12-2013
in order to find out the date of the files i have used the below code

ls|rev|cut -d "." -f2|cut -d "_" -f1|rev

this gives me the dates of all the files in the format ddmmyyyy.

now if i can change this to YYYYMMDD then my problem is solved. I would be able to bring the files which have this above calculated date greater than the last run date.
can this be done??

---------- Post updated at 01:27 PM ---------- Previous update was at 01:17 PM ----------

if the date can be changed to YYYYMMDD then i can use the code below to bring the relative files.

Code:
set -vx
TARGET_DIR=$2
SOURCE_DIR=$1
LOGDIR=/info_d05/visage/SrcFiles/IQAlign/Log_Files
b=`cat $LOGDIR/last_date.txt`
for i in $SOURCE_DIR/Novawise*
do
 fname=`basename $i`
 p=`echo $fname|rev|cut -d "." -f2|cut -d "_" -f1|rev|something`
  if [ $p -gt $b ]
  then
   cp $SOURCE_DIR/$fname $TARGET_DIR/
  fi
  
done

the something part needs to be completed...

Last edited by radoulov; 03-12-2013 at 07:17 AM.. Reason: Code tags fixed.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

get yesterday date in yyyymmdd format

I would like to know how I could get a yesterday date in yyyymmdd e.g. today is 20011109, and I would like to get 20011108. Thank you!:confused: (2 Replies)
Discussion started by: hk_newbie
2 Replies

2. HP-UX

How can i get the yesterday's date in YYYYMMDD format

How can i get the yesterday's date in YYYYMMDD format??? (4 Replies)
Discussion started by: prasadsr
4 Replies

3. Shell Programming and Scripting

Convert filenames with DDMMYYYY to YYYYMMDD

Okay, I have posted on here one other time and received very fast help, so I figured I'd post again. Searched for awhile and couldn't find exactly what I'm looking for. I am attempting to write a script that will search through a given directory, or search through the current directory, and... (10 Replies)
Discussion started by: cbo0485
10 Replies

4. UNIX for Dummies Questions & Answers

Format date from MM/DD/YYYY to YYYYMMDD

I have a file with some date columns in MM/DD/YYYY format: SMPBR|DUP-DO NOT USE|NEW YORK||16105|BA5270715|6/6/2007 |MWERNER|109||||JOHN||SMITH|MD|72211118||||||74559|21 WILMINGTON RD||D|11/6/2003|SL# MD CONTACT-LIZ RICHARDS|||0|Y|N||1411458| And I want to convert the date format to: ... (5 Replies)
Discussion started by: ChicagoBlues
5 Replies

5. Shell Programming and Scripting

convert date format YYYYMMDD to MM/DD/YYYY

In my shell script i have a variable which stores date in the format of YYYYMMDD. Is there any way to format this value to MM/DD/YYYY. Thanks. (8 Replies)
Discussion started by: nasirgondal
8 Replies

6. Shell Programming and Scripting

Change the date format from mmddyyyy to yyyymmdd

How do I change the date format from mmddyyyy to yyyymmdd in PERL. Can any one help me please. (3 Replies)
Discussion started by: thankful123
3 Replies

7. Solaris

Date after 5 dates in YYYYMMDD format

Hi Experts, How to get date 5 days after current date in YYYYMMDD format? How do we compare date in YYYYMMDD format? Thanks (1 Reply)
Discussion started by: needyourhelp10
1 Replies

8. Shell Programming and Scripting

Date after 5 days from current date in YYYYMMDD format

Hello Experts, How do i get date after 5 days from current date in YYYYMMDD format? How do you compare date in YYYYMMDD format? Thanks (8 Replies)
Discussion started by: needyourhelp10
8 Replies

9. Shell Programming and Scripting

Validating date in yyyymmdd format using PERL

Hi all, i had a code where in user will enter a date in yyyymmdd format.. i didnt use any validation for the date and now the problem is if a user enters date instead of month after year it is proceeding with the code.. like if the date is 20120426 and if the user enters 20122604 it... (4 Replies)
Discussion started by: smarty86
4 Replies

10. Shell Programming and Scripting

Command to check date format DDMMYYYY

Record: Record1|Record2|Record3|Record4|Record5|DATE1|DATE2 Need to Check DATE1 & DATE2 is in DDMMYYYY format in a file. records which not meet the date format DDMMYYYY extract to other file. (1 Reply)
Discussion started by: vivekn
1 Replies
SVN::Web::Browse(3pm)					User Contributed Perl Documentation				     SVN::Web::Browse(3pm)

NAME
SVN::Web::Browse - SVN::Web action to browse a Subversion repository SYNOPSIS
In config.yaml actions: ... browse: class: SVN::Web::Browse action_menu: show: - directory link_text: (browse directory) ... DESCRIPTION
Returns a file/directory listing for the given repository path. OPTIONS
rev The repository revision to show. Defaults to the repository's youngest revision. TEMPLATE VARIABLES
at_head A boolean value, indicating whether or not the user is currently browsing the HEAD of the repository. context Always "directory". entries A list of hash refs, one for each file and directory entry in the browsed path. The list is ordered with directories first, then files, sorted alphabetically. Each hash ref has the following keys. name The entry's name. path The entry's full path. rev The entry's most recent interesting revision. size The entry's size, in bytes. The empty string '' for directories. type The entry's "svn:mime-type" property. Not set for directories. author The userid that committed the most recent interesting revision for this entry. date The date of the entry's most recent interesting revision, formatted according to "Time and date formatting" in SVN::Web. msg The log message for the entry's most recent interesting revision. rev The repository revision that is being browsed. Will be the same as the "rev" parameter given to the action, unless that parameter was not set, in which case it will be the repository's youngest revision. youngest_rev The repository's youngest revision. EXCEPTIONS
(path %1 does not exist in revision %2) The given path is not present in the repository at the given revision. (path %1 is not a directory in revision %2) The given path exists in the repository at the given revision, but is not a directory. This action is only used to browse directories. COPYRIGHT
Copyright 2003-2004 by Chia-liang Kao "<clkao@clkao.org>". Copyright 2005-2007 by Nik Clayton "<nik@FreeBSD.org>". This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> perl v5.14.2 2012-06-11 SVN::Web::Browse(3pm)
All times are GMT -4. The time now is 06:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy