![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Date Conversion | jgrant746 | Shell Programming and Scripting | 3 | 05-24-2008 02:16 PM |
| Date Conversion | MJDRM | UNIX for Dummies Questions & Answers | 5 | 01-29-2008 06:20 PM |
| date conversion | tonet | Shell Programming and Scripting | 2 | 07-07-2006 10:23 AM |
| Date Conversion | dafidak | UNIX for Advanced & Expert Users | 2 | 07-04-2006 05:16 PM |
| date conversion | sunil bajaj | UNIX for Dummies Questions & Answers | 3 | 04-17-2002 01:54 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
vgersh99- wonder if your still around? How would you alter your awk script to process the date if it appeared in the first field of a comma delimited file? i.e
JAN 03 2009 05:30:00:PM,data1,data2,data3 to 2009/01/03 17:30:00,data1,data2,data3 sorry, probably a very simple question? |
|
||||
|
Thanks vgersh99, that worked great.
so sprintf can be used to assign strings to vars and in awk you can reassign new strings to the field vars. maybe I should move this to a different forum, but I've just hit an error because one of the input lines is longer than 3000 bytes. Is there anyway of getting around this? or am i going to have to truncate the string? |
|
|||||
|
Quote:
If you're on Solaris, try /usr/xpg4/bin/awk YMMV |
|
|||||
|
Quote:
Code:
BEGIN {
monN=split("JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC", months)
for(i=1; i<=monN; i++) {
months[months[i]]=i;
delete months[i];
}
}
{ gsub(":", "", $3);printf("2009%02d%02d%04d\n", months[toupper($1)], $2, $3) }
|
|
||||
|
Quote:
And it worked PERFECTLY!!!! Thanks for your help GURU in Unix! Appreciate it! |
![]() |
| Bookmarks |
| Tags |
| linux, ubuntu |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|