Hi Ken,

Why not using SQLites datetime functions directly: 
https://www.sqlite.org/lang_datefunc.html?
Should work in db.select or at least db.execute...

Cheres,
Stefan

-----Original Message-----
From: grass-user [mailto:[email protected]] On Behalf Of Ken 
Mankoff
Sent: onsdag 11. januar 2017 18.54
To: [email protected]
Subject: [GRASS-user] update column w/ output from bash function

Hi List,

I have a DB with a columns JD and YMD (julian day, and a varchar for a better 
date string format). I have a bash function for the conversion. I'm having 
trouble figuring out how to populate the YMD column.

Conversion function:

jul2ymd () { gdate -d "$1-01-01 +$2 days -1 day" "+%Y-%m-%d"; }

Neither db.execute nor db.select appear to work with arbitrary bash commands. 
I's there some way to do something similar to the following to fill the new 
column?

v.db.update map=DB column=YMD value=$(jul 2015 $(v.db.select map=DB column=JD))

I can imagine a scenario where I loop over every row and then use v.db.update 
and the VALUE option, but that seems inefficient.

Thanks,

  -k.


_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to