Sponsored Content
Top Forums Shell Programming and Scripting gawk convert 2012-Jun-13 to 2012-06-13 Post 302655585 by trey85stang on Wednesday 13th of June 2012 11:26:33 AM
Old 06-13-2012
gawk convert 2012-Jun-13 to 2012-06-13

I have a value in a file i am processing that has a date like "2012-Jun-13"

how can I convert a date like that 2012-06-13?

Am I stuck building an array of three digit months and corresponding numbers and running through the logic of figuring out the number??

or can I convert this with strftime? if so I cant figure out how... Im also cool with dropping down to the shell level and using gnu date to do this. But I dont know how to pull a system call back into gawk as a variable.

Any ideas?

---------- Post updated at 10:26 AM ---------- Previous update was at 10:17 AM ----------

I found another post details what I need to do this with a system call..

Quote:
Originally Posted by fbg

I could find the answer in other post. Need to do:

echo 40 | awk ' { comm="test.sh "$1; comm | getline y; close(comm); print y } '

Is a nice trick
If anyone knows how to do this without a system call, i would still like to know.

Thanks,
Trey
 

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
deleg_proc(n)						       Interpreter utilities						     deleg_proc(n)

__________________________________________________________________________________________________________________________________________________

NAME
deleg_proc - Creation of comm delegates (procedures) SYNOPSIS
package require Tcl 8.3 package require interp::delegate::proc ?0.2? ::interp::delegate::proc ?-async? name arguments comm id _________________________________________________________________ DESCRIPTION
This package provides a single command for the convenient creation of procedures which delegate the actual work to a remote location via a "channel" created by the package comm. API
::interp::delegate::proc ?-async? name arguments comm id This commands creates a procedure which is named by name and returns its fully-qualified name. All invokations of this procedure will delegate the actual work to the remote location identified by the comm channel comm and the endpoint id. The name of the remote procedure invoked by the delegator is [namespace tail name]. I.e., namespace information is stripped from the call. Normally the generated procedure marshalls the arguments, and returns the result from the remote procedure as its own result. If however the option -async was specified then the generated procedure will not wait for a result and return immediately. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category interp of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
comm, delegation, interpreter, procedure CATEGORY
Programming tools COPYRIGHT
Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net> interp 0.2 deleg_proc(n)
All times are GMT -4. The time now is 06:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy