Sponsored Content
Top Forums Shell Programming and Scripting DateTime Format Conversion in a File Post 302141893 by aajan on Tuesday 23rd of October 2007 08:18:35 AM
Old 10-23-2007
This wil be simple


for file in `cat bb`
do
var=`echo $file | cut -d"-" -f1`
var2=`echo $file | cut -d"-" -f2`
var3=`echo $file | cut -d"-" -f3`
value1=`echo $var | cut -d"/" -f1`
value2=`echo $var | cut -d"/" -f2`
value3=`echo $var | cut -d"/" -f3`
echo $value2"/$value3""/$value1""-$var2".$var3
done
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Flat File Conversion Format

Hi all, I've a flat file in this format: = " Record 1 Field1 -> XXXX Field2 -> 9558 Field3 -> 55AA Record 2 Field1 -> YYYY Field2 -> 12345 Field3 -> aa23 " And i want to convert it to (4 Replies)
Discussion started by: Loobian
4 Replies

2. Shell Programming and Scripting

format conversion

Is there any direct way in shell to convert exponential to other formats. For example 1.5e-07 to 0.150u. Or does shell support this microns, nano meter notations? (1 Reply)
Discussion started by: abhijanvt
1 Replies

3. Shell Programming and Scripting

Datetime Format 'yyyymmddmiss' Calculation

Given a time format yyyymmddmiss 201007221403 How can I add or minus minutes such that it becomes 201007221348 when I minus away 15 minutes from the time? Also, given a time frame, let say 10 days, how do I check if a date 201006231403 that is not more than 10 days behind... (3 Replies)
Discussion started by: alienated
3 Replies

4. Ubuntu

Conversion of the format of a file in linux

How to convert a rtf file to a ttf file in ubuntu terminal? (2 Replies)
Discussion started by: poonam.gaigole
2 Replies

5. Shell Programming and Scripting

Conversion of below Tabs Tex file into CSV format file : shell script needed

Request if some one could provide me shell script that converts the below "input file" to "CSV format file" given Name Domain Contact Phone Email Location ----------------------- ------------------------------------------------ ------- ----- ---------------------------------... (7 Replies)
Discussion started by: sreenath1037
7 Replies

6. Shell Programming and Scripting

Conversion of spaces Text file into CSV format file

Input file (each line is separaed by spaces )given below: Name Domain Contact Phone Email Location ----------------------- ------------------------------------------------ ------- -----... (18 Replies)
Discussion started by: sreenath1037
18 Replies

7. Shell Programming and Scripting

conversion of spaces into CSV format file

INput file attached in thread : Column widths at 24,73,82,87,121 characters (sed 's/./,/24;s/./,/73;s/./,/81;s/./,/87;s/./,/121;s/ *, */,/g' fixedinputfile >output.csv ). The client wants instead of hard coding the column widths as they are not fixed .he has given the hint stating that ( ... (3 Replies)
Discussion started by: sreenath1037
3 Replies

8. Shell Programming and Scripting

XML dateTime format in shell script

How can i frame current date & time in the xml standard dateTime format in shell script 2011-10-18T12:00:00.000000 I got up to the date format using the below code date '+%Y'-'%m'-'%d'T ---------- Post updated at 09:10 AM ---------- Previous update was at 08:53 AM ---------- ... (6 Replies)
Discussion started by: vel4ever
6 Replies

9. Shell Programming and Scripting

Date conversion from 24 hr format to 12 hr format

hi i want to convert date procured from sone operation which will be in 24hr format to 12 hr format displaying AM and PM # date -d @1362545068 Tue Mar 5 23:44:28 EST 2013 # this Tue Mar 5 23:44:28 EST 2013 i want to convert it so that output is as below Tue... (2 Replies)
Discussion started by: vivek d r
2 Replies

10. Shell Programming and Scripting

Format conversion

Can you help me get the desired output? Below is the input CONA= 0. 5. 10. 15. 20. 25. 30. 35. 40. 45. 50. 55. 60. 65. 70. 75. 80. 85. 90. 95. 100. 105. 110. PLANA= 0. 15. 30. 45. 60. 75. 90. 105. 120. 135. 150. 165. 180. ITABLE= 87.3 171.4 242.9 297.6 322.8 325.6 306.8 284.5 273.4 272.2 270.2... (6 Replies)
Discussion started by: Ravi S M
6 Replies
DateTime::Format::Epoch::MJD(3pm)			User Contributed Perl Documentation			 DateTime::Format::Epoch::MJD(3pm)

NAME
DateTime::Format::Epoch::MJD - Convert DateTimes to/from Modified Julian Days SYNOPSIS
use DateTime::Format::Epoch::MJD; my $dt = DateTime::Format::Epoch::MJD->parse_datetime( 53244 ); # 2004-08-27T00:00:00 DateTime::Format::Epoch::MJD->format_datetime($dt); # 53244 my $formatter = DateTime::Format::Epoch::MJD->new(); my $dt2 = $formatter->parse_datetime( 53244 ); # 2004-08-27T00:00:00 $formatter->format_datetime($dt2); # 53244 DESCRIPTION
This module can convert a DateTime object (or any object that can be converted to a DateTime object) to the Modified Julian Day number. See DateTime::Format::Epoch::JD for a description. METHODS
Most of the methods are the same as those in DateTime::Format::Epoch. The only difference is the constructor. o new() Constructor of the formatter/parser object. It has no parameters. SUPPORT
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details. AUTHOR
Eugene van der Pijll <pijll@gmx.net> COPYRIGHT
Copyright (c) 2004 Eugene van der Pijll. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
DateTime datetime@perl.org mailing list perl v5.10.1 2007-12-03 DateTime::Format::Epoch::MJD(3pm)
All times are GMT -4. The time now is 09:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy