Search This Blog

Monday, April 26, 2010

Cool ways of adding numbers in a text file in bash:

awk '{s+=$0} END {print s}' /tmp/file.txt

paste -sd+ /tmp/file.txt | bc

Source: http://unstableme.blogspot.com/2009/11/sum-of-numbers-in-file-unix.html

Saturday, April 24, 2010

Problem with Fortran + C code compilation:

undefined reference to `iargc_'
undefined reference to `getarg_'


Solution: use '_gfortran_iargc()' and '_gfortran_getarg_i4()' instead of 'iargc_()' and 'getargc_()'. This is specific to the situation where you link C with Fortran.
On the cluster, these are defined in /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgfortran.a.

http://osdir.com/ml/gcc.fortran/2005-02/msg00297.html
http://old.nabble.com/getarg-and-iargc-in-gcc-4.0.2-td1803996.html

Other links on Fortran + C compilation:

http://www.fnal.gov/docs/UNIX/unix_a.../uatf-107.html
http://astro.berkeley.edu/~wright/f2c.html
http://www.yolinux.com/TUTORIALS/Lin...rtranAndC.html