[GRASS-user] update column w/ output from bash function
Ken Mankoff
mankoff at gmail.com
Wed Jan 11 09:54:23 PST 2017
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.
More information about the grass-user
mailing list