02-17-2009
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Heres a script i wrote as a bit of practise. What it does is insert a line in the middle of a file. The line being $1 and the file being $2
#!/bin/bash
rm tempfile
touch tempfile
count=1
linenum= `wc -l < $2`
if
then
echo $1 >> $2
else
even=`expr "$linenum" % 2`
if
then... (3 Replies)
Discussion started by: Quesa
3 Replies
2. UNIX for Dummies Questions & Answers
Hay, guys,
Any ideas how to calculate like this:
in first file, there're number of lines listing 2+3, 6*9 .......
Then, how to get the result and put them in another file in format:
2+3 5
6*9 54
......
sheerly by shell command, no scripts required. (4 Replies)
Discussion started by: robbinGlasses
4 Replies
3. Shell Programming and Scripting
Hi,
Is there a way to evaluate an equation contained in a string within an AWK script?
For example:
A = "(5*2)-1" (this equation is read from a file and varies line by line)
In this example, I can't see any way to get an answer of 9 unless I do:
cmd = "awk 'BEGIN{print "A"}'"
cmd |... (3 Replies)
Discussion started by: srdgeo
3 Replies
4. Shell Programming and Scripting
Hello,
I'm trying to write a while loop for a decimal value in tcsh which I know can't be done. Instead I want my increments to be one order of magnitude too large and then divide it by 10 when I use the variable. However, I don't know how to divide my variable and set it as another.
set... (1 Reply)
Discussion started by: DFr0st
1 Replies
5. High Performance Computing
I'm running a MPI program using a cluster of 4 machines(different machines of different processing power,cpu utilization etc.). I'm trying to balance the computation among the machine to get the minimum execution time for that. I tried to balance it by creating a threshold value by taking the load... (1 Reply)
Discussion started by: chamila1986
1 Replies
6. Shell Programming and Scripting
Hi All
I've made a few scripts which using GDAL extract the value of a pixel within a given raster. The purpose is to work out the combine value of every pixel. I thought there may have been an easier way to do this but alas!
The code below extracts the pixel value at position X Y. The... (3 Replies)
Discussion started by: StudentFitz
3 Replies
7. Shell Programming and Scripting
Hi, I am trying to make a maths calculator that:
1. Prompts the user for a number.
2. Prompts the user for an operation (add, subtract, divide or multiply)
3. Prompts the user for a number.
4. Prompts the user for another operation (same as above) OR the option to get the result for the... (4 Replies)
Discussion started by: johnthebaptist
4 Replies
8. Shell Programming and Scripting
Hi,
Need help on this. I need to increment a variable by 1 but retain as 2 characters.
I am using expr to do additions:
NEWSERIAL=`expr $SERIAL + 1`
$SERIAL can range from 01-99. After adding "1", I need the result to be 2 characters, eg: 02+1 = 03. By default expr will truncate the... (4 Replies)
Discussion started by: vchee
4 Replies
9. Shell Programming and Scripting
HI All,
I have a script in bash that i want that script will perform action
When the size of a particular folder exceeds the 80%.
Here is an example of script that result is exactly 80% :
#!/bin/bash
CHECK=$(df -h /var/log/syslog | grep '80%' | xargs echo | cut -d' ' -f5)
if ];... (1 Reply)
Discussion started by: Aviel.shani
1 Replies
10. Shell Programming and Scripting
Hi guys...
I am loving this integer maths thing.
64 bit systems are certainly easier than 32 bit, but hey, I don't intend to leave out my fav' platform.
Using one of the 'Brothers' methods, URL inside the code.
#!/bin/sh
#
# #!/usr/local/bin/dash
# e_constant.sh
# Brother's formula .
#... (2 Replies)
Discussion started by: wisecracker
2 Replies
LEARN ABOUT DEBIAN
math::symbolic::custom::defaultdumpers
Math::Symbolic::Custom::DefaultDumpers(3pm) User Contributed Perl Documentation Math::Symbolic::Custom::DefaultDumpers(3pm)
NAME
Math::Symbolic::Custom::DefaultDumpers - Default Math::Symbolic output routines
SYNOPSIS
use Math::Symbolic qw/parse_from_string/;
$term = parse_from_string(...);
my ($sub, $leftover_trees) = $term->to_sub();
DESCRIPTION
This is a class of default output routines for Math::Symbolic trees. Likewise, Math::Symbolic::Custom::DefaultTests defines default tree
testing routines and Math::Symbolic::Custom::DefaultMods has default tree modification methods. For details on how the custom method
delegation model works, please have a look at the Math::Symbolic::Custom and Math::Symbolic::Custom::Base classes.
EXPORT
Please see the docs for Math::Symbolic::Custom::Base for details, but you should not try to use the standard Exporter semantics with this
class.
SUBROUTINES
to_string
The to_string method is currently implemented in the module core namespaces and will be moved to Math::Symbolic::DefaultDumpers in a future
release.
Takes one optional argument indicating whether the Math::Symbolic tree should be transformed to a string using 'postfix' notation or using
'infix' notation. Default is infix which is also more likely to be reparseable by the Math::Symbolic parser.
to_code
This method is a wrapper around the compile_to_code class method in the Math::Symbolic::Compiler module. Takes key/value pairs of variables
and integers as argument. The integers should starting at 0 and they determine the order of the variables/parameters to the compiled code.
Returns the compiled code and a reference to an array of possible leftover tree elements that could not be compiled.
Please refer to the Math::Symbolic::Compiler man page for details.
to_sub
This method is a wrapper around the compile_to_sub class method in the Math::Symbolic::Compiler module. Takes key/value pairs of variables
and integers as argument. The integers should starting at 0 and they determine the order of the variables/parameters to the compiled code.
Returns the compiled sub and a reference to an array of possible leftover tree elements that could not be compiled.
Please refer to the Math::Symbolic::Compiler man page for details.
AUTHOR
Please send feedback, bug reports, and support requests to the Math::Symbolic support mailing list: math-symbolic-support at lists dot
sourceforge dot net. Please consider letting us know how you use Math::Symbolic. Thank you.
If you're interested in helping with the development or extending the module's functionality, please contact the developers' mailing list:
math-symbolic-develop at lists dot sourceforge dot net.
List of contributors:
Steffen Mueller, symbolic-module at steffen-mueller dot net
Stray Toaster, mwk at users dot sourceforge dot net
Oliver Ebenhoeh
SEE ALSO
New versions of this module can be found on http://steffen-mueller.net or CPAN. The module development takes place on Sourceforge at
http://sourceforge.net/projects/math-symbolic/
Math::Symbolic::Custom Math::Symbolic::Custom::DefaultMods Math::Symbolic::Custom::DefaultTests Math::Symbolic
perl v5.10.1 2011-01-01 Math::Symbolic::Custom::DefaultDumpers(3pm)