简体   繁体   中英

How to pass multiple inputs in command-line?

I am trying to execute a command that merges chromosome data. As I need to merge data from chromosomes 1..22 and X and Y, I wanted to see if there is a better way to do this. I can provide myfile.list below to merge chromosome data.

plink1.9 --bfile --merge-list myfile.list --make-bed --out mymerged

myfile.list is a text file that would contain:

data.chr1.b
data.chr2.b
...
... 
data.chr22.b
data.chrX.b
data.chrY.b

Instead of supplying a text file myfile.list , I wanted to use a variable with all data names in this command. What would be the better way to do this? Something like this?

plink1.9 --bfile --merge-list cat `echo "data.chr"{1..22}. X. Y.` --make-bed --out mymerged 

Use process substitution

plink1.9 --bfile --merge-list <(for i in {1..22} X Y; do echo data.chr$i; done) --make-bed --out mymerged 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM