Reputation: 1293
Suppose I have a command which require two parameter, such as
bismark -1 R1_1.fastq -2 R1_2.fastq
And actually, R1_1.fastq and R1_2.fastq can be obtain with
ls *fastq | paste - -
or can be obtain with
echo samplelist.txt
my question is how to merge these two command into one line?
ls *fastq | paste - - | xargs -n 2 | bismark -1 {} -2 {}
Thanks.
Upvotes: 2
Views: 89
Reputation: 33685
With GNU Parallel you would do:
ls *fastq | parallel -N2 bismark -1 {1} -2 {2}
Upvotes: 1
Reputation: 1
while read f g
do
bismark -1 "$f" -2 "$g"
done < samplelist.txt
Or:
xargs -n2 sh -c 'bismark -1 "$1" -2 "$2"' . < samplelist.txt
Upvotes: 2
Reputation:
With an array, it would be simple:
a=(*fastq) ; bismark -1 "${a[0]}" -2 "${a[1]}"
Upvotes: 1