Tag Archive

amateur astronomy awk bash be b[e] supergiant cartoon conference convert exoplanet fedora figaro fits fun history iraf jupiter latex linux magellanic clouds massive star matplotlib meteor mypaper ondrejov observatory optical paper peblo photo photometry planet pro-am pyraf python scisoft skinakas observatory small magellanic cloud smc spectroscopy starlink talk theli ubuntu university of crete video x-ray

Merging catalogs and creating unique identifier in bash

For a certain project I had created a number of photometric catalogs, each one corresponding to a specific observing field. I would like to construct the final (merged) one but for this I needed to add a unique source identifier at the beginning of each row. I decided to create a F#-**** tag for each […]

Log and awk

When using the log function of awk, then what we get as a result is the natural logarithmic of the input, like: …$ awk ‘BEGIN{print log(100)}’ …$ 4.60517 So in order to obtain the logarithm of base 10 (or any other base), we just need to divide the result with the logarithm of the base, […]

External variable inside awk

Sometimes, a variable may be needed to get inside awk (for or while loop for example). In order to pass the variable inside awk, include it like: awk -v i=$i ‘{ .. }’ test

Mean value and standard deviation of a column using awk

In order to get the mean value of column 1 (or any other) you type: $ awk ‘BEGIN{s=0;}{s=s+$1;}END{print s/NR;}’ file In order to get the standard deviation of column 1 you type: $ awk ‘{sum+=$1; sumsq+=$1*$1} END {print sqrt(sumsq/NR – (sum/NR)^2)}’ file or $ awk ‘{delta = $1 – avg; avg += delta / NR; […]