Groups | Search | Server Info | Login | Register
| From | Poutounet <Poutou@net.com> |
|---|---|
| Newsgroups | comp.lang.awk |
| Subject | Can awk interpret algebraic fields? |
| Date | 2011-04-19 15:03 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <iok16f$j4e$1@speranza.aioe.org> (permalink) |
Hello,
I have a file with algebraic expressions as fields. I would like awk to interpret them (i.e.,
compute the results with specific values for each of the variables the expression contains).
I tried the following example (in a unix-like shell):
echo "5.*a" | awk -v a=2 '{print 0+$1}'
but I get "5" as a result because awk only retains "5." and considers the rest as non-number
characters (as far as I understand how it works).
Is it possible to have awk compute the algebraic expression and return 10, which is what I expect?
Thanks in advance for any advice,
Poutounet
Back to comp.lang.awk | Previous | Next — Next in thread | Find similar
Can awk interpret algebraic fields? Poutounet <Poutou@net.com> - 2011-04-19 15:03 +0200
Re: Can awk interpret algebraic fields? gazelle@shell.xmission.com (Kenny McCormack) - 2011-04-19 13:39 +0000
Re: Can awk interpret algebraic fields? spcecdt@armory.com (John DuBois) - 2011-04-19 11:42 -0500
Re: Can awk interpret algebraic fields? Poutounet <Poutou@net.com> - 2011-04-22 11:36 +0200
Re: Can awk interpret algebraic fields? Janis Papanagnou <janis_papanagnou@hotmail.com> - 2011-04-22 14:55 +0200
csiph-web