[PLUG] Date Reformatting in Database Table

Joe Pruett joey at clean.q7.com
Thu Oct 8 20:57:52 UTC 2009


> 1993-1|Water Quality|WVR|Yamhill, City of|Yamhill|Hamlin|Holt|Npv|NPDES-Waste Discharge Limits|7/6/1993|01993-1|Water Quality|WVR|Yamhill, City
> of|Yamhill|Hamlin|Holt|Npv|NPDES-Waste Discharge Limits|7/6/1993|0
>
>   Is there a practical way to apply sed and/or awk to convert the date
> column above from 7/6/1993 to 1993-06-07?

awk -F\| 'BEGIN{OFS="|"}{split($10, x, "/");$10=sprintf("%04d-%02d-%02d",x[3],x[2],x[1]);print}'



More information about the PLUG mailing list