[GRASSLIST:4621] Re: String splitting in BASH...
Hamish
hamish_nospam at yahoo.com
Fri Oct 22 20:57:10 EDT 2004
> What I would like to do is:
>
> RET = echo "select age, cover from play_att where link_key = $MYCAT" |
> db.select -c`
>
> where RET will look something like "100|1002". I then use BASH to
> string split RET and assign to AGE and COVER (both integers).
> This would elliminate one database query and would speed things up
> further.
>
> But I can't figure out how to do this string-splitting in BASH!!
awk will certainly work. many ways to solve a problem.
here's another, maybe more simple:
AGE=`echo "$RET" | cut -f1 -d'|'`
COVER=`echo "$RET" | cut -f2 -d'|'`
Hamish
More information about the grass-user
mailing list