Sponsored Content
Top Forums Shell Programming and Scripting convert date format to mysql date format in log file Post 302293480 by hazno on Tuesday 3rd of March 2009 07:00:16 AM
Old 03-03-2009
convert date format to mysql date format in log file

I have a comma delimited log file which has the date as MM/DD/YY in the 2nd column, and HH:MM:SS in the 3rd column.

I need to change the date format to YYYY-MM-DD and merge it with the the time HH:MM:SS. How will I got about this?

Sample input

Code:
02/27/09,23:52:31
02/27/09,23:52:52
02/27/09,23:54:53
02/27/09,23:57:46

Desired output
Code:
2009-02-27 23:52:31

thanks & regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

convert mmddyy date format to ccyyddd format??

hi, for reading a cobol indexed file i need to convert "mmddyy" date format to "ccyyddd" format. i checked the datecalc and other scripts but couldnt modify them to cater to my need:(... The datecalc gives an output which i believe is the total days till that date, but i want to convert it... (2 Replies)
Discussion started by: Bhups
2 Replies

2. UNIX for Dummies Questions & Answers

Convert date format

Hi All, Need your help in converting a date format in ksh. I'm currently working on SUN os where my script is getting a date from a table. The result returns to ksh in this format: 17-JUL-08 How do i convert this string to a date format like yyyymmdd? I tried #!/bin/ksh d="17-JUL-08"... (5 Replies)
Discussion started by: agathaeleanor
5 Replies

3. Shell Programming and Scripting

Convert Epoch time format to normal date time format in the same file

I have a file named "suspected" with series of line like these : {'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''} {'protocol': 17, 'service': 'BitTorrent... (3 Replies)
Discussion started by: rk4k
3 Replies

4. UNIX for Dummies Questions & Answers

Changing from Excel date format to MySQL date format

I have a list of dates in the following format: mm/dd/yyyy and want to change these to the MySQL standard format: yyyy-mm-dd. The dates in the original file may or may not be zero padded, so April is sometimes "04" and other times simply "4". This is what I use to change the format: sed -i '' -e... (2 Replies)
Discussion started by: figaro
2 Replies

5. Shell Programming and Scripting

convert date format

I've been using this thread: https://www.unix.com/shell-programming-scripting/58675-change-date-dd-mmm-yyyy-mm-dd-yyyy.html and https://www.unix.com/shell-programming-scripting/14655-changing-yyyy-mm-dd-ddmmyy.html and this code: on this format: 05/16/2008 18:30:49 Installation 48985and I'm... (3 Replies)
Discussion started by: dba_frog
3 Replies

6. Shell Programming and Scripting

Convert the date format from mdy to ymd in column of file

The date format in the delimited file for one column '6/27/2011 12:00:00 AM' Is it possible o change it to '2011-06-27 12:00:00 AM' for all the records.. Thanks in advance..... (8 Replies)
Discussion started by: infernalhell
8 Replies

7. Shell Programming and Scripting

Need a unix script to convert date into Julian format in a text file

The 6th & 7th column of the text files represents date & time. I need this to be converted in julian format using command "date +%s -d <date>". I know the command, but dont know how to use it on the script 0 dbclstr-b IXT_Web Memphis_Prod_SQL_Full Memphis-Prod-SQL-Full-Application-Backup... (4 Replies)
Discussion started by: ajiwww
4 Replies

8. UNIX for Dummies Questions & Answers

Rename all Files in a UNIX Directory from one date format to another date format

Hi Unix Gurus, I would like to rename several files in a Unix Directory . The filenames can have more than 1 underscore ( _ ) and the last underscore is always followed by a date in the format mmddyyyy. The Extension of the files can be .txt or .pdf or .xls etc and is case insensitive ie... (1 Reply)
Discussion started by: pchegoor
1 Replies

9. Shell Programming and Scripting

Convert Date Format

Hello, I want to change the format of date value in variable. e.g. cur_date = '2013/03/13 14:24:50' (yyyy/mm/dd hh24:mi:ss) I want to change this to '13-MAR-2013 14:24:50 Following code coverts the current date to format I am looking for. But I do not know how this can be done for a date... (8 Replies)
Discussion started by: cartrider
8 Replies

10. Shell Programming and Scripting

Convert date format

Hi guys I am looking to convert this kind of entry in a txt file 26/04/2008 to April 2008 Note : this is not using the date command , these are date entries in a file can i do this with sed ? Use code tags, thanks. (5 Replies)
Discussion started by: johnnybananas
5 Replies
W2DO(1) 						User Contributed Perl Documentation						   W2DO(1)

NAME
w2do - a simple text-based todo manager SYNOPSIS
w2do [-l] [-t task] [-g group] [-d date] [-p priority] [-f|-u] w2do -a task [-g group] [-d date] [-p priority] [-f|-u] w2do -c id [-t task] [-g group] [-d date] [-p priority] [-f|-u] w2do -r id w2do [options] DESCRIPTION
w2do is a simple to use yet efficient command-line todo manager written in Perl. OPTIONS
General Options -l, --list Display items in the task list. All tasks are listed by default, but desired subset can be easily selected via specifying options as well. Since listing is the default action, this option can be safely omitted. -a task, --add task Add new item with selected task name to the task list. When no additional specifying options are given, the group general, the due date anytime and the priority 3 is used by default and the task is marked as unfinished. -c id, --change id Change item with selected id in the task list. Further specifying options are required in order to take any effect. -r id, --remove id Remove item with selected id from the task list. --change-group group Change all items in the selected group. Further specifying options are required in order to take any effect. --remove-group group Remove all items from the selected group. --purge-group group Remove all finished items from the selected group. --change-date date Change all items with selected due date. Further specifying options are required in order to take any effect. --remove-date date Remove all items with selected due date. --purge-date date Remove all finished items with selected due date. --change-pri priority Change all items with selected priority. Further specifying options are required in order to take any effect. --remove-pri priority Remove all items with selected priority. --purge-pri priority Remove all finished items with selected priority. --change-old Change all items with passed due date. Further specifying options are required in order to take any effect. --remove-old Remove all items with passed due date. --purge-old Remove all finished items with passed due date. --change-all Change all items in the task list. Further specifying options are required in order to take any effect. --remove-all Remove all items from the task list. --purge-all Remove all finished items from the task list. --undo Revert last action. When invoked, the data are restored from the backup file (i.e. "~/.w2do.bak" by default), which is deleted at the same time. --groups Display comma-delimited list of all groups in the task list. --stats Display detailed task list statistics. -h, --help Display help message and exit. -v, --version Display version information and exit. Specifying Options -t task, --task task Specify the task name. -g group, --group group Specify the group name. The group name should be a single word with maximum of 10 characters, but longer names are shortened automatically. -d date, --date date Specify the due date. Available options are anytime, today, yesterday, tomorrow, month, year, or an exact date in the YYYY-MM-DD format, e.g. 2008-06-17 for 17 June 2008. -p priority, --priority priority Specify the priority. Available options are integers between 1 and 5, where 1 represents the highest priority. -f, --finished Specify the finished task. -u, --unfinished Specify the unfinished task. Additional Options -s file, --savefile file Use selected file instead of the default "~/.w2do" as a save file. -w width, --width width Use selected line width; the minimal value is 75. -q, --quiet Avoid displaying messages that are not necessary. -V, --verbose Display all messages; this is the default option. -C, --colour, --color Use coloured output instead of the default plain text version. -X, --no-colour, --no-color Use plain text output (no colours); this is the default option. -b, --bare Do not display table header and group separators. -B, --no-bare Display table header and group separators; the default option. -I, --no-id Do not display ID column in the listing. --with-id Display ID column in the listing; the default option. -G, --no-group Do not display group column in the listing. --with-group Display group column in the listing; the default option. -D, --no-date Do not display due date column in the listing. --with-date Display due date column in the listing; the default option. -P, --no-priority Do not display priority column in the listing. --with-priority Display priority column in the listing; the default option. -S, --no-state Do not display state column in the listing. --with-state Display state column in the listing; the default option. ENVIRONMENT
W2DO_SAVEFILE Use selected file instead of the default "~/.w2do" as a save file. W2DO_WIDTH Use selected line width; the minimal value is 75. FILES
~/.w2do Default save file. ~/.w2do.bak Default backup file. SEE ALSO
w2html(1), w2text(1), perl(1). BUGS
To report bugs or even send patches, you can either add new issue to the project bugtracker at <http://code.google.com/p/w2do/issues/>, visit the discussion group at <http://groups.google.com/group/w2do/>, or you can contact the author directly via e-mail. AUTHOR
Written by Jaromir Hradilek <jhradilek@gmail.com>. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included as a file called FDL in the main directory of the w2do source package. COPYRIGHT
Copyright (C) 2008, 2009, 2010 Jaromir Hradilek This program is free software; see the source for copying conditions. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Version 2.3.1 2010-02-13 W2DO(1)
All times are GMT -4. The time now is 08:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy