DATA="/home/nine/lab"
SampleName="MM20567"
Folder="$DATA/merged_fastqs"
tree "$Folder"
/home/nine/lab/merged_fastqs
└── MM20567
├── MM20567_01_S17_L001_I1_001.fastq.gz
├── MM20567_01_S17_L001_R1_001.fastq.gz
├── MM20567_01_S17_L001_R2_001.fastq.gz
├── MM20567_02_S18_L001_I1_001.fastq.gz
├── MM20567_02_S18_L001_R1_001.fastq.gz
├── MM20567_02_S18_L001_R2_001.fastq.gz
├── MM20567_03_S19_L001_I1_001.fastq.gz
├── MM20567_03_S19_L001_R1_001.fastq.gz
├── MM20567_03_S19_L001_R2_001.fastq.gz
├── MM20567_04_S20_L001_I1_001.fastq.gz
├── MM20567_04_S20_L001_R1_001.fastq.gz
└── MM20567_04_S20_L001_R2_001.fastq.gz
DATA="/home/nine/lab"
SampleName="MM20567"
Folder="$DATA/merged_fastqs"
cd "$Folder"
for i in $(ls -d */)
do
SampleName="${i%%/}"
Merged_SampleName=`echo $( ls "$SampleName" | awk -F "_" '{ print $1 "_" $2 }' | sort -u) | tr ' ' ','`
echo "$SampleName"
echo "$Merged_SampleName"
done
MM20567
MM20567_01,MM20567_02,MM20567_03,MM20567_04
Be First to Comment