I have some questions about using the basename function in bash.
I have some paths stored in a file called filename2.txt
, it looks something like this:
/data/sequedas/Miseq2/17031_M0446
/data/sequedas/Miseq2/17022_N0213
/data/sequedas/Miseq2/28103_N3123
...
So I was running a loop trying to do something to each of the folder above:
while read line;
do interop_imaging_table $line > basename $line ;
done < filename2.txt
Basically I want to use basename $line
to remove everything in the path of the filename except the last part. So that I would be left with the following in the filename by using basename $line
:
17031_M0446
17022_N0213
28103_N3123
But unfortunately it doesn't work for some reasons. Basically the output will all output to the file called basename
. But I was hoping it would output separately to files called 17031_M0446
, 17022_N0213
, ....