I have a directory with a bunch of files
ExperimentA_Rep1.bed ExperimentA_Rep2.bed ExperimentA_Rep3.bed ExperimentB_Rep1.bed ExperimentD_Rep1.bed ExperimentC_Rep1.bed ExperimentC_Rep2.bed . . . ExperimentZ_Rep5.bed
I need to scan through the filenames in a directory and concatenate the files that are from the same experiment, but different replicates, into a new file.
cat ExperimentA_Rep1.bed ExperimentA_Rep2.bed > ExperimentA_merged.bed
But I can't hardcode this, it needs to be applicable for any dataset of experiments.
If I ran a python script that would be okay.