I process files found by ls
as
ls /folder/ | parallel -j20 ./command {}
but I need to pass the job number as well. I tried
ls /folder/ | parallel -j20 ./command {1} {2} ::: {1..20}
ls /folder/ | parallel -j20 ./command {} {} ::: {1..20}
but it does not work. I also tried {#}
for passing the job number.
ls
in a script. Using afor
loop orfind
is always the better solution. – mashuptwice Feb 20 '22 at 11:19https://mywiki.wooledge.org/ParsingLs
– mashuptwice Feb 20 '22 at 11:30./command file1.txt 1
and./command file2.txt 2
etc.? – terdon Feb 20 '22 at 11:57./command
script is irrelevant here. Consider it as a bash script withecho "$1 $2"
. Yes, the aim is to run/command file1.txt 1
or/command 1 file1.txt
. The order is not important as I can change the arguments inside the script. – Googlebot Feb 20 '22 at 12:55