[PLUG] Reformating date fields in text files [FIXED]

Rich Shepard rshepard at appl-ecosys.com
Sat Jan 15 19:17:36 UTC 2022


On Sat, 15 Jan 2022, Rich Shepard wrote:

> I don't know perl and have it almost working in awk.

I don't know why the script worked the last time I used it because it
certainly didn't work this time. However, this brief script works for the
current data file:
------
#!/usr/bin/gawk -f
BEGIN { FS=OFS="|" }
{ split ($6, a, "/"); printf "%s,%s,%s,%s,%s,%s-%s-%s,%s\n", $1, $2, $3, $4, $5, a[3], a[1], a[2], $7; }
------

The original script has a second split() which sent me off in the wrong
direction.

Thanks to all who responded,

Rich



More information about the PLUG mailing list