You can try something like
for filepath in $(ls -1 /home/travc/seq_v2/AgamP4_v2/samples/*/qualimap/qualimap.log);
sed -n '/Num mapped reads/p' $filepath >> /data/home/odkirling/Mali/Yeah1.txt
This will need the path before and after
* to be exactly the same.
If your files are in a sequence, say
ERS224591, you can use
seq 61 91. In this case, the script will be
for filenum in $(seq -w 30 150);
sed -n '/Num mapped reads/p' "/home/travc/seq_v2/AgamP4_v2/samples/ERS2245$filenum/qualimap/qualimap.log" >> /data/home/odkirling/Mali/Yeah1.txt
Or let's say you have a list of directories in a text file, in the following format
then you can do something like
for dirname in $(cat dir_names.txt);
sed -n '/Num mapped reads/p' "/home/travc/seq_v2/AgamP4_v2/samples/$dirname/qualimap/qualimap.log" >> /data/home/odkirling/Mali/Yeah1.txt
dir_names.txt is the file containing your directory names. Similarly, you should be able to replace any part of the file path based on your requirements.