One-liner to run commands from a file in parallel using xargs
0
votes
3
answers
1773
views
I have a script like this:
-shell
#!/bin/csh
command 1 \
-f \"input1\" \
-l input2 -other_swithes1
command 2 \
-f \"input1\" \
-m input2 \
-l input3 -other_swithes1
command 3 \
-f \"input1\" \
-l input2 -other_swithes2
so any idea for an one-liner with xargs
to run these commands in parallel. I tried various variants but all failed. I do not really want to write a script, I think that should have been possible with -d switch and -c, not sure though.
To simplify and extend the problem further, what I have is
cat file | grep -v "#.*" | sed -z 's/[\]\n/ /g' | xargs -I {} -n1 -P10 sh -c '{}'
and while this does the job there is a particular problem and that is that \"
get removed. So any clue how to solve that?!
Asked by inman
(9 rep)
Aug 23, 2021, 12:31 PM
Last activity: Jun 30, 2025, 01:48 PM
Last activity: Jun 30, 2025, 01:48 PM