Get file basename and create a new one in bash
Since I often do this operation in a for loop in bash, I thought it would be handy to store it here:
for f in ../star/S01*bam ;
do fname=$(basename $f _Aligned.sortedByCoord.out.bam);
echo "${fname}.chr08.bam";
done
Written on April 22, 2021