On 01/25/2012 04:44 AM, gene heskett wrote: > Why not try (g)awk? You can search, match strings, and do some math with > it. Of course you could always use a combination of sed, awk and bash, > or simply perl. > I looked at the gawk man page, didn't see any mention of floating point > math so I kept on looking. Bash only does integer. Didn't see any mention > of sed& math or floating point. >
BC is a precision calculator, that works in BASH, but it has a known rounding error, that caused me all kinds of problem. If you have perl, you can do floating point math like this: perl -e 'printf(STDOUT "%.3f\n", eval($Math_goes_here))'; The %.3f is the precision, which can be run out to many multiple decimal places. The \n is a newline command. Without it, the output will be appended to the current line. It is easy to embed in other scripts with a variable in the eval() statement. The precison can also be a variable. I have many BASH scripts that use this same command. -- -Mark Ne M'oubliez ---Family Motto Hope for the best, plan for the worst ---Personal Motto ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users