-I changed uppercase letter to lowercase, but not working again!
-I already run awk script lonely, its ok.
-The cod is not working, because it can not find input directory.
Obviously For should be for (lowercase) like alister notes, but also, the content of the unquoted variable expansion $FILES is subject to field splitting (default: space, TAB or newline), which may lead to erroneous results and which will not occur with the second form...
when I run the code without copy the results, it is ok.
#! /bin/bash
FILES=/root/Desktop/decoder/input/*
for f in $FILES
do
awk '{$6=($1-64)/2 ;$7=((10^($6/10))/250)^(1/1.2) ; print}' OFS="\t" "$f";
done
But when I wanna save the results in separate txt files, it is not working.
#! /bin/bash
FILES=/root/Desktop/decoder/input/*
for f in $FILES
do
awk '{$6=($1-64)/2 ;$7=((10^($6/10))/250)^(1/1.2) ; print}' OFS="\t" "$f" > "/root/Desktop/decoder/input/out/"$f".txt "
done
I got this error:
[root@localhost decoder]# t1
./t1: line 6: /root/Desktop/decoder/input/out//root/Desktop/decoder/input/out.txt: No such file or directory
./t1: line 6: /root/Desktop/decoder/input/out//root/Desktop/decoder/input/SG1140103020247.CAP98RE.txt: No such file or directory
[root@localhost decoder]#
Furthermore, I tried to put output directory after done , but it is also not working.
I have a lot of files in Input and I want to have the results of all the files in separate folder.
If you are going to specify the path to the target directory in your redirection, then you need to strip directories from $f and only use the basename.