Sponsored Content
Top Forums Shell Programming and Scripting gawk convert 2012-Jun-13 to 2012-06-13 Post 302655641 by clx on Wednesday 13th of June 2012 12:25:25 PM
Old 06-13-2012
Code:
echo "2012-Jun-13" | awk -F- 'BEGIN {
	a["Jan"] = "01";
	a["Feb"] = "02";
	a["Mar"] = "03";
	a["Apr"] = "04";
	a["May"] = "05";
	a["Jun"] = "06";
	a["Jul"] = "07";
	a["Aug"] = "08";
	a["Sep"] = "09";
	a["Oct"] = "10";
	a["Nov"] = "11";
	a["Dec"] = "12";
} { print $1 FS a[$2] FS $3 }'

 

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do i compare two dates with format Jan 01, 2012 and Jan 00 2012

I need to be able to compare dates in the format of Jan 10, 2012 and Jan 10 2012. (Notice one has a comma). Then I need to find the date that is 7 days before those dates if they are equal. How can I do this in Bash. Thank ahead (4 Replies)
Discussion started by: ojthejuice
4 Replies

2. Post Here to Contact Site Administrators and Moderators

Event Prediction - Euro 2012

Please add this new "event". (10 Replies)
Discussion started by: ni2
10 Replies

3. What is on Your Mind?

Tennis - Wimbledon 2012

For those of you watching Wimbledon you already know that Rafael Nadal will not be in the final. There is an open event in the Event Prediction Forum. Place your bits on the guys left. This event closes on Sunday 8th July 2012. (0 Replies)
Discussion started by: ni2
0 Replies

4. Shell Programming and Scripting

Date conversion help from dd/mm/yyyy to dd/Mon/yyyy i.e. 28/10/2012 to 28/Oct/2012

Hi I have a problem with Date format in my code. 1st I am trying to convert today's date to yesterday's using YESTERDAY3=`perl -e '@y=localtime(time()-86400); printf "%04d/%02d/%02d",$y+1900,$y+1,$y;$y;'` And once it is done I am trying to using the yesterday date in a grep command to... (3 Replies)
Discussion started by: nithinankam
3 Replies

5. What is on Your Mind?

Place your bits - 2012 FIFA Ballon d'Or and 2012 FIFA World Coach of the Year

I have added two new sports events. The FIFA Ballon d'Or is an association football award given annually to the player who is considered to have performed the best in the previous season. It is awarded based on votes by coaches and captains of international teams, as well as journalists from... (0 Replies)
Discussion started by: ni2
0 Replies

6. HP-UX

HP ux 11i v3 september 2012 Media

Hello Friends, I bought HP-UX 9000 series server. They shipped it with HP-UX 11.31 March 2014 version operating system. But i want to reload it with HP ux 11i v3 september 2012. I have only hardware support for this box, so i cant get it from HP site. Can any tell me where can i download it.... (4 Replies)
Discussion started by: corequad
4 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 11:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy