I am performing a bash loop one liner:.
for k in */centrifuge/kreport/*.txt; do cat $k | cut -f 1,3 > /krona/$k.krona; echo $k; done
The file hierarchy is as follows:
\Drain_4
\centrifuge
\kreport
A6_kreport.txt
A4_kreport.txt
A5_kreport.txt
\krona
\Drain_5
\Drain_7
Where \
denotes a directory. This is the error i am getting:
-bash: /krona/Drains_2/centrifuge/kreport/A4_kreport.txt: No such file or directory
I am trying to output the file into the krona directory which is in the working directory however when i try to i get that error. When i remove the "/krona" after > the code execute fine so guessing i am having problems with telling it where to output the file but i can't work it out. Any help would be greatly appreciated.
Do you actually need
/krona/
(in the root folder) or rather justkrona/
in the current directory?Ideally i would like a folder in the same directory as the three kreport.txt files which contains the results (the altered version of these three files). Drain_5 and Drain_7 also have the same file structure so hopefully the loop will produce the same result as well.