Hello and good day
I am not familiar with programming. I have text files and I would like to:
1) edit script to input "a" and "b" parameters by users
2)put input directories in loop :
Something like this:
Ex: For i in /usr/desktop/input/SG*
3)add 2 more columns and performing arithmetic operations.
4)add name to column
(my files start with SG; Ex: "SG140101120000.CAP5xyz.txt" )
I found this script, but it is not complete.
#! /bin/bash
echo "a value"
read a
echo "b value"
read b
For i in SG*;
do
awk '{$6=($1-64)/2 ;$7=((10^($6/10))/$a)^(1/$b) ; print}' OFS="\t" $i > /root/Desktop/decoder/output_gr_ubrb/1/$i.txt;
done
Orginal txt file:
$1 $2 $3 $4
74 3.99166 101.37082 2.000
74 3.99166 101.37834 2.000
75 3.98416 101.37082 2.000
75 3.98416 101.37834 2.000
81 3.96916 101.29571 2.000
0 3.96166 101.28820 2.000
82 3.96166 101.29571 2.000
85 3.96167 101.31073 2.000
Expected result:
$1 $2 $3 $4 $5 $6
74 3.99166 101.37082 2.000 5 0.0748783
74 3.99166 101.37834 2.000 5 0.0748783
75 3.98416 101.37082 2.000 5.5 0.0804649
75 3.98416 101.37834 2.000 5.5 0.0804649
81 3.96916 101.29571 2.000 8.5 0.12391
0 3.96166 101.28820 2.000 -32 0.000364633
82 3.96166 101.29571 2.000 9 0.133155
85 3.96167 101.31073 2.000 10.5 0.165237
Thanks in advance