Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #5078
| Newsgroups | comp.lang.java.programmer |
|---|---|
| From | Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> |
| Subject | Re: “Stardate” Version Numbering |
| References | <isl3rm$o72$1@lust.ihug.co.nz> <4dee15eb$0$49174$e4fe514c@news.xs4all.nl> <ism9of$egf$1@lust.ihug.co.nz> |
| Message-ID | <slrniutcrl.phi.avl@gamma.logic.tuwien.ac.at> (permalink) |
| Date | 2011-06-07 23:25 +0000 |
Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> wrote: > In message <4dee15eb$0$49174$e4fe514c@news.xs4all.nl>, Silvio wrote: >> What about date +%s%N > Close. Try this version: doesn’t need Julian, and also shorter: > sed -i -r 's/(android:versionName=\")[^\"]*(\")/\1'"$(bc <<<"scale = 1; ($(date +%s)) / 86400")"'\2/' AndroidManifest.xml I don't quite see the reason why you would actually capture the closing double-quote char... and double-quotes aren't special to "sed -r", so they need no backslash before them. Then the last lingle-quoted part can be included into the double-quoted middle part, re-introducing one \", but making it again shorter. Also, removing some redundant spaces, quotes and parens from around bc, and replacing one of the $(...) with backticks shortens it again. sed -i -r 's/(android:versionName=")[^"]*"/\1'$(bc<<<scale=1\;`date +%s`/86400)\"/ AndroidManifest.xml Btw., it won't be compatible with older shells (e.g. ksh), though, for the "<<<".
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
“Stardate” Version Numbering Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-07 11:59 +0000
Re: “Stardate” Version Numbering Silvio <silvio@moc.com> - 2011-06-07 14:13 +0200
Re: “Stardate” Version Numbering bugbear <bugbear@trim_papermule.co.uk_trim> - 2011-06-07 13:51 +0100
Re: “Stardate” Version Numbering Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-06-07 18:15 -0300
Re: “Stardate” Version Numbering Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-08 10:46 +1200
Re: “Stardate” Version Numbering Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-06-07 23:25 +0000
Re: “Stardate” Version Numbering Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-06-07 18:52 +0200
csiph-web