These are the list of files Contol_Input_sorted.bam_rem.bam Control_H2BUb_sorted.bam_rem.bam Control_IgG_sorted.bam_rem.bam PTPN6_g2_6_H2Bub_sorted.bam_rem.bam PTPN6_g2_6_Input_sorted.bam_rem.bam So to get unique files i do this ls -1 *bam | sort | sed -r 's/_sorted.bam_rem.bam//g' | sort | uniq Contol_Input Control_H2BUb Control_IgG PTPN6_g2_6_H2Bub PTPN6_g2_6_Input Now i have to run each sample against input and IgG for peak-calling. Like `Control_H2BUb_sorted.bam_rem.bam` against Contol_Input_sorted.bam_rem.bam & Control_IgG_sorted.bam_rem.bam and PTPN6_g2_6_H2Bub_sorted.bam_rem.bam against PTPN6_g2_6_Input_sorted.bam_rem.bam So how do I parse and execute using gnu parallel. I came across this [tutorial][1] where it does something like this cat sample_names.txt | parallel --max-procs=12 'macs2 callpeak -t {}-A-NC.sorted.bam \ -c {}-G-NC.sorted.bam -g hs -n {}-A-NC-sharp-model -q 0.01 --outdir {}-A-NC-sharp-model-peaks 2> {}-A-NC-sharp-model.stderr' Now im not sure how to pass the file names as argument for IP and Input or IgG. If i use logic a little bit i have to fix Control and PTPN6_g2_6 as constant naming!. Any suggestion or help would be really appreciated. [1]: http://crazyhottommy.blogspot.com/2015/09/macs2-parallel-peak-calling.html