Sponsored Content
Top Forums Shell Programming and Scripting Validate date and time in filename by awk Post 302964543 by MOHANP12 on Friday 15th of January 2016 11:57:20 AM
Old 01-15-2016
Quote:
Originally Posted by chakrapani
So the assumption is $2 will be 20151222 or like YYYMMDD year month and day is this right ?
yes you right
Quote:
single line awk get value with field separator '.'
$2 is date yyyymmdd format
$3 is date yyyymmdd format
$4 is time hhmmss format
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Renaming files to have date/time in filename

I have a program that will export my data to a single file, but it assigns a file name that is overridden every time I run the program. I need to change the file name to have a sequential number in the filename. How do I rename a file so that the filename contains the system date and time. I want... (5 Replies)
Discussion started by: wayneb
5 Replies

2. UNIX for Dummies Questions & Answers

Insert date/time within a filename

Hi Guys, I need to script the renaming of files as followins: files: firstjd secondjo thirdjv My script needs to insert the date/time infront of the last 2 characters of the filenames above, any ideas greatly received :) the letters before the last 2 characters could change, I'm only... (7 Replies)
Discussion started by: cooperman
7 Replies

3. UNIX for Advanced & Expert Users

find formatted filename with date time

Hi, I operate and use HF radars along the California coast for ocean surface currents. The devices use Mac OS as the control and logging software. The software generates thousands of files a week and while I've used PERL in the past to solve the problems of finding files I come to realize some... (6 Replies)
Discussion started by: dpath2o
6 Replies

4. UNIX for Dummies Questions & Answers

Adding Date & time stamps to filename

I need to edit the file name with date and time while writing the script. please help. (1 Reply)
Discussion started by: manish.s
1 Replies

5. UNIX for Dummies Questions & Answers

Shell Scripts - Append a filename with date and time....

Hello, I need to create a shell script that appends a filename to create a name with the date and time appended that is guaranteed to not exist. That is, the script insures you will not overwrite a file with the same name. I am lost with this one. I know I need to use date but after that I am... (3 Replies)
Discussion started by: citizencro
3 Replies

6. Shell Programming and Scripting

append a filename with system date and time

Hi, There are similar kind of posts, but none seems like working for me. Please correct me if I'm wrong. I need append/rename file abc.txt with file processed date and time like abc_systemdatetimestamp.txt and move it to different folder. for example I have /source/data/abc.txt ... (1 Reply)
Discussion started by: amsn08
1 Replies

7. UNIX for Dummies Questions & Answers

Converting string date time to unix time in AWK

I'd like to convert a date string in the form of sun aug 19 09:03:10 EDT 2012, to unixtime timestamp using awk. I tried This is how each line of the file looks like, different date and time in this format Sun Aug 19 08:33:45 EDT 2012, user1(108.6.217.236) all: test on the 17th ... (2 Replies)
Discussion started by: bkkid
2 Replies

8. Shell Programming and Scripting

Validate date file format using awk

Here is my sample data Test.txt column 1|columne 2|start Date|end Date test|test|03/24/2014|03/24/2014 test|test|03/24-2014|03/24/2014 test|test|03/24/2014|03/24/2014 test|test|03/24/2014|03/24-2014 test|test|03/24/2014|03/24/2014 Now in the file i am expecting the date fields should be... (4 Replies)
Discussion started by: krish2014
4 Replies

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

10. 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
IDATE(1)							   User Commands							  IDATE(1)

NAME
idate - A Gregorian/Meladi to/from Hijri/Islamic date converter SYNOPSIS
idate [--gregorian yyyymmdd] [--hijri yyyymmdd] [--simple] [--umm_alqura] [--help] DESCRIPTION
The idate program is a Gregorian to Hijri (and vice-versa) date converter. The application uses and offers multiple calculation methods with not all of them agreeing at all times. The reason for this multiplicity is due to not having one agreed upon method and so various entities develop and advocate their calculations. idate is able to comprehend and calculate both pre-epoch or pre-Hijrah, denoted as "B.H", as well as post-epoch or post-Hijrah, denoted as "A.H", dates. idate also utilizes Gregorian's pre-epoch "B.C" and post-epoch "A.D" dates and notes them per its output. When entering pre-epoch years, negative numbers ought to be utilized. idate when run without any command-line options uses the host machine's current Gregorian date and converts it to Hijri. OPTIONS
idate follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of all options is noted below: -h, --help Show summary of options -g, --gregorian yyyymmdd Specify the Gregorian date to be converted where 'y' stands for year, 'm' for month and 'd' for day -hi, --hijri yyyymmdd Specify the Hijri date to be converted where 'y' stands for year, 'm' for month and 'd' for day -s, --simple Specify a simplified output mode -u, --umm_alqura Specify to use the Umm Al-Qura calculation method (used mostly in Saudi Arabia) BACKGROUND
The Hijri calendar is used in most of the Arab world and is the symbolic calendar of the Islamic faithed worldwide. This calendar is known as the "Hijri" (based on the word "Hijrah" - denoting migration in Arabic) to signal Prophet Mohammed's (PBUH) migration from Makkah to Medinah on Thursday, July 15, 622 AD (Julian) or July 19, 622 AD (Gregorian). The Islamic Hijri calendar is strictly lunar (ie. moon-based) with twelve lunar months which do not correspond or track their solar coun- terparts (the Gregorian calendar is a solar or sun-based calendar). Lunar years and thus Hijri years are, on average, about 354 days long resulting in a Hijri year being roughly about 11 days shorter than its Gregorian counterpart. There is much discussion and confusion regarding how best to track the Hijri calendar. A great deal of that confusion is based on the fact that many rely on a human moon sighting to denote the start (or end) of a month (each month of the Hijri calendar starts when a new moon's crescent is observed or is made visible at sunset) as opposed to using an empirical mathematic certainty. The methods presented in this application and its underlying ITL library are strictly arithmetic in nature and do NOT take moon-phases into consideration (in short, observational approximation is not used). LIMITATIONS
The Umm Al-Qura option doesn't function with pre-epoch settings. REPORTING BUGS
Report bugs on the web using http://bugs.arabeyes.org AUTHOR
Written by Nadim Shaikli as part of the Arabeyes.org project. COPYRIGHT
idate is subject to the GNU General Public License (GPL). Copyright (C) 2005, Arabeyes, Nadim Shaikli. SEE ALSO
The ITL library (libitl) from the Islamic Tools and Libraries project. It is the underlying requirement for idate to function. The ITL library was created and is hosted at www.arabeyes.org. idate January 05, 2005 IDATE(1)
All times are GMT -4. The time now is 12:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy