hi, i am creating a script that given a file with multiple fields, take the first and return everything on a single output line: file name, number of lines, sum, average and standard deviation ....
I have the commands to calculate them but I don't know which command to use to concatenate them and put everything on the same output line
#!/bin/bash
if [ $# -eq 1 ] ;
then
filename="/home/marco/$1"
base=`basename "$filename"`
noext=${base%.*}
echo -n " $noext " ;
wc -l $1 | awk '{print $1}' ;
awk '{SUM+=$1}END{print SUM}' $1
awk '{sum+=$1} END {print sum/NR}' $1
awk 'NR>2 {sum+=$1; array[NR]=$1} END {for(x=1;x<=NR;x++){sumsq+=((array[x]-(sum/NR))^2);}print sqrt(sumsq/NR)}' $1
fi