Sponsored Content
Top Forums Shell Programming and Scripting How can I apply 'date' command to specific columns, in a BASH script? Post 303018774 by Scrutinizer on Thursday 14th of June 2018 06:37:07 PM
Old 06-14-2018
Another variety:
Code:
awk '
  BEGIN {
    FS=OFS=","
    split("January,February,March,April,May,June,July,August,September,October,November,December", MNUM)
    for(i in MNUM)
      MON[MNUM[i]]=i                                                                         
  }                          
  {
    for(i=1; i<=NF; i++)
      if ($i ~ /^[[:alpha:]]+ [0-9]{1,2} [0-9]{4}$/) {
        split($i, D, " ")
        $i=sprintf("%d-%02d-%02d",D[3],MON[D[1]],D[2])
      }                                               
    print
  }      
' file


Last edited by Scrutinizer; 06-15-2018 at 04:33 AM.. Reason: FS was defined in the wrong place. Thanks RudiC..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script to get info from specific rows & columns (.xls file)

Hi all, I want to read some specific rows & columns in the .xls file with my script to get the data to be manipulated. Now, I can read the .xls file correctly & i can go to the specific sheet that I want but i have a problem to specify the specific rows & columns. I mean, I want to get the info... (0 Replies)
Discussion started by: Yohannita
0 Replies

2. Shell Programming and Scripting

script for get lines with specific date

I'm a newbie in AIX, i want to make a script for grep any lines with date bellow 20 PRINT0089-88615 data1 3072 Mon Dec 19 17:53:49 WITA 2011 PRINT0089-88616 data1 4096 Mon Dec 19 17:53:49 WITA 2011 PRINT0089-88618 data1 5120 Mon Dec 19... (7 Replies)
Discussion started by: michlix
7 Replies

3. Shell Programming and Scripting

find command to filter specific type of files older than certain date.

Hi I need to find the list of files in a directory and to do some specific operations based on the type of files. suppose in a directory am having .dat , .log, .err, .rej file types. i need to filter out .dat and .log only which are older than six months. i used the below query but the... (2 Replies)
Discussion started by: msathees
2 Replies

4. Shell Programming and Scripting

Need to view command in history for specific date

hi i want to find a command in history for specific date . is it possible that i can view ?? (1 Reply)
Discussion started by: scriptor
1 Replies

5. UNIX for Dummies Questions & Answers

Want to get list of Linux commands used on specific date through HISTORY command

I want to get list of linux commands used on Jan 01 2014 with the help of HISTORY command or some other linux commands,. Kindly help. (3 Replies)
Discussion started by: karthick nath
3 Replies

6. Shell Programming and Scripting

Read Two Columns - Apply Condition on Six other columns

Hello All, Here is my input univ1 chr1 100 200 - GeneA 500 1 0 0.1 0.2 0.3 0.4 0.5 univ1 chr1 100 200 - GeneA 600 1 0 0.0 0.0 0.0 0.0 0.1 univ1 chr1 100 200 - GeneA 700 1 0 0.4 0.4 ... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

7. Shell Programming and Scripting

Perl script to accept specific columns from excel

Hi All, I have below perl script which writes xml from .xls file. Now i want to add below two conditions in this script : 1. to check if the the input .xls file has ony two columns , if more tahn two columns then script should pop up an error. 2. If there are two columns , then first column... (4 Replies)
Discussion started by: omkar.jadhav
4 Replies

8. Shell Programming and Scripting

Script to check for a specific number of columns in a file

Hi All I have a file which has five columns in each rows. cat file.txt a|b|c|d|e 1|2|3|4|5 a1|a2|a3|a4|a5 . . . I need to make sure that there are no less than five or more than five columns (in all the rows) by mistake. I tried this : cat file.txt | awk 'BEGIN{FS="|"};{print... (3 Replies)
Discussion started by: chatwithsaurav
3 Replies

9. Shell Programming and Scripting

Bash to select text and apply it to a selected file in bash

In the bash below I am asking the user for a panel and reading that into bed. Then asking the user for a file and reading that into file1.Is the grep in bold the correct way to apply the selected panel to the file? I am getting a syntax error. Thank you :) ... (4 Replies)
Discussion started by: cmccabe
4 Replies

10. Shell Programming and Scripting

Shell script to apply functions to multiple columns dynamically

Hello, I have a requirement to apply hashing algorithm on flat file on one or more columns dynamically based on header sample input file ID|NAME|AGE|GENDER 10|ABC|30|M 20|DEF|20|F say if i want multiple columns based on the header example id,name or id,age or name,gender and hash and... (13 Replies)
Discussion started by: mkathi
13 Replies
DateTime::Locale::sid(3)				User Contributed Perl Documentation				  DateTime::Locale::sid(3)

NAME
DateTime::Locale::sid SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'sid' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Sidamo. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) Sanyo Maakisanyo Roowe Hamuse Arbe Qidaame Sambata Abbreviated (format) San Mak Row Ham Arb Qid Sam Narrow (format) S M R H A Q S Wide (stand-alone) Sanyo Maakisanyo Roowe Hamuse Arbe Qidaame Sambata Abbreviated (stand-alone) San Mak Row Ham Arb Qid Sam Narrow (stand-alone) S M R H A Q S Months Wide (format) January February March April May June July August September October November December Abbreviated (format) Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Narrow (format) J F M A M J J A S O N D Wide (stand-alone) January February March April May June July August September October November December Abbreviated (stand-alone) Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Narrow (stand-alone) J F M A M J J A S O N D Quarters Wide (format) Q1 Q2 Q3 Q4 Abbreviated (format) Q1 Q2 Q3 Q4 Narrow (format) 1 2 3 4 Wide (stand-alone) Q1 Q2 Q3 Q4 Abbreviated (stand-alone) Q1 Q2 Q3 Q4 Narrow (stand-alone) 1 2 3 4 Eras Wide BCE CE Abbreviated YIA YIG Narrow YIA YIG Date Formats Full 2008-02-05T18:30:30 = Maakisanyo, February 05, 2008 1995-12-22T09:05:02 = Arbe, December 22, 1995 -0010-09-15T04:44:23 = Qidaame, September 15, -10 Long 2008-02-05T18:30:30 = 05 February 2008 1995-12-22T09:05:02 = 22 December 1995 -0010-09-15T04:44:23 = 15 September -10 Medium 2008-02-05T18:30:30 = 05-Feb-2008 1995-12-22T09:05:02 = 22-Dec-1995 -0010-09-15T04:44:23 = 15-Sep--10 Short 2008-02-05T18:30:30 = 05/02/08 1995-12-22T09:05:02 = 22/12/95 -0010-09-15T04:44:23 = 15/09/-10 Default 2008-02-05T18:30:30 = 05-Feb-2008 1995-12-22T09:05:02 = 22-Dec-1995 -0010-09-15T04:44:23 = 15-Sep--10 Time Formats Full 2008-02-05T18:30:30 = 6:30:30 hawwaro UTC 1995-12-22T09:05:02 = 9:05:02 soodo UTC -0010-09-15T04:44:23 = 4:44:23 soodo UTC Long 2008-02-05T18:30:30 = 6:30:30 hawwaro UTC 1995-12-22T09:05:02 = 9:05:02 soodo UTC -0010-09-15T04:44:23 = 4:44:23 soodo UTC Medium 2008-02-05T18:30:30 = 6:30:30 hawwaro 1995-12-22T09:05:02 = 9:05:02 soodo -0010-09-15T04:44:23 = 4:44:23 soodo Short 2008-02-05T18:30:30 = 6:30 hawwaro 1995-12-22T09:05:02 = 9:05 soodo -0010-09-15T04:44:23 = 4:44 soodo Default 2008-02-05T18:30:30 = 6:30:30 hawwaro 1995-12-22T09:05:02 = 9:05:02 soodo -0010-09-15T04:44:23 = 4:44:23 soodo Datetime Formats Full 2008-02-05T18:30:30 = Maakisanyo, February 05, 2008 6:30:30 hawwaro UTC 1995-12-22T09:05:02 = Arbe, December 22, 1995 9:05:02 soodo UTC -0010-09-15T04:44:23 = Qidaame, September 15, -10 4:44:23 soodo UTC Long 2008-02-05T18:30:30 = 05 February 2008 6:30:30 hawwaro UTC 1995-12-22T09:05:02 = 22 December 1995 9:05:02 soodo UTC -0010-09-15T04:44:23 = 15 September -10 4:44:23 soodo UTC Medium 2008-02-05T18:30:30 = 05-Feb-2008 6:30:30 hawwaro 1995-12-22T09:05:02 = 22-Dec-1995 9:05:02 soodo -0010-09-15T04:44:23 = 15-Sep--10 4:44:23 soodo Short 2008-02-05T18:30:30 = 05/02/08 6:30 hawwaro 1995-12-22T09:05:02 = 22/12/95 9:05 soodo -0010-09-15T04:44:23 = 15/09/-10 4:44 soodo Default 2008-02-05T18:30:30 = 05-Feb-2008 6:30:30 hawwaro 1995-12-22T09:05:02 = 22-Dec-1995 9:05:02 soodo -0010-09-15T04:44:23 = 15-Sep--10 4:44:23 soodo Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 Mak 1995-12-22T09:05:02 = 22 Arb -0010-09-15T04:44:23 = 15 Qid Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 hawwaro 1995-12-22T09:05:02 = 9:05 soodo -0010-09-15T04:44:23 = 4:44 soodo Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 hawwaro 1995-12-22T09:05:02 = 9:05:02 soodo -0010-09-15T04:44:23 = 4:44:23 soodo M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (M-d) 2008-02-05T18:30:30 = 2-5 1995-12-22T09:05:02 = 12-22 -0010-09-15T04:44:23 = 9-15 MEd (E, M-d) 2008-02-05T18:30:30 = Mak, 2-5 1995-12-22T09:05:02 = Arb, 12-22 -0010-09-15T04:44:23 = Qid, 9-15 MMdd (dd/MM) 2008-02-05T18:30:30 = 05/02 1995-12-22T09:05:02 = 22/12 -0010-09-15T04:44:23 = 15/09 MMM (LLL) 2008-02-05T18:30:30 = Feb 1995-12-22T09:05:02 = Dec -0010-09-15T04:44:23 = Sep MMMd (MMM d) 2008-02-05T18:30:30 = Feb 5 1995-12-22T09:05:02 = Dec 22 -0010-09-15T04:44:23 = Sep 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = Mak Feb 5 1995-12-22T09:05:02 = Arb Dec 22 -0010-09-15T04:44:23 = Qid Sep 15 MMMMd (MMMM d) 2008-02-05T18:30:30 = February 5 1995-12-22T09:05:02 = December 22 -0010-09-15T04:44:23 = September 15 MMMMdd (dd MMMM) 2008-02-05T18:30:30 = 05 February 1995-12-22T09:05:02 = 22 December -0010-09-15T04:44:23 = 15 September MMMMEd (E MMMM d) 2008-02-05T18:30:30 = Mak February 5 1995-12-22T09:05:02 = Arb December 22 -0010-09-15T04:44:23 = Qid September 15 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (y-M) 2008-02-05T18:30:30 = 2008-2 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -10-9 yMEd (EEE, y-M-d) 2008-02-05T18:30:30 = Mak, 2008-2-5 1995-12-22T09:05:02 = Arb, 1995-12-22 -0010-09-15T04:44:23 = Qid, -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 Feb 1995-12-22T09:05:02 = 1995 Dec -0010-09-15T04:44:23 = -10 Sep yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = Mak, 2008 Feb 5 1995-12-22T09:05:02 = Arb, 1995 Dec 22 -0010-09-15T04:44:23 = Qid, -10 Sep 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 February 1995-12-22T09:05:02 = 1995 December -0010-09-15T04:44:23 = -10 September yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 Q1 1995-12-22T09:05:02 = 1995 Q4 -0010-09-15T04:44:23 = -10 Q3 yyMM (MM/yy) 2008-02-05T18:30:30 = 02/08 1995-12-22T09:05:02 = 12/95 -0010-09-15T04:44:23 = 09/-10 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = February 2008 1995-12-22T09:05:02 = December 1995 -0010-09-15T04:44:23 = September -10 Miscellaneous Prefers 24 hour time? No Local first day of the week Sanyo SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.16.3 2014-06-10 DateTime::Locale::sid(3)
All times are GMT -4. The time now is 10:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy