2019-02-27T22:13:36.7819247182019-03-12T01:40:23.357999303P11DT5H49M15S40LibreOffice/6.0.6.2$Linux_X86_64 LibreOffice_project/00m0$Build-22019-03-08T23:06:56.779293422 15875 0 22287 11042 true false view2 18724 25474 0 15875 22285 26915 0 1 false 250 false false false false false false false false true false true true false uAH+/1hlcm94X1BoYXNlcl82MTQwRE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ1VQUzpYZXJveF9QaGFzZXJfNjE0MEROAAAAAAAAAAAWAAMA2QAAAAAAAAAEAAhSAAAEdAAASm9iRGF0YSAxCnByaW50ZXI9WGVyb3hfUGhhc2VyXzYxNDBETgpvcmllbnRhdGlvbj1Qb3J0cmFpdApjb3BpZXM9MQpjb2xsYXRlPWZhbHNlCm1hcmdpbmRhanVzdG1lbnQ9MCwwLDAsMApjb2xvcmRlcHRoPTI0CnBzbGV2ZWw9MApwZGZkZXZpY2U9MQpjb2xvcmRldmljZT0wClBQRENvbnRleERhdGEKRHVwbGV4Ok5vbmUAUGFnZVNpemU6QTQASW5wdXRTbG90OkF1dG9TZWxlY3QAABIAQ09NUEFUX0RVUExFWF9NT0RFDwBEdXBsZXhNb2RlOjpPZmY= true false false true false true false 816919 false false true false false true true true true true true false false 1 false true false false false Xerox_Phaser_6140DN false false false false 0 false 0 true false false false false false true false false false true 1662577 true false false false high-resolution true true true false false false false false false false false false true false 0 true GNU Parallel Cheat Sheet GNU Parallel is a replacement for xargs and for loops. It can also split a file or a stream into blocks and pass those to commands running in parallel. Examples Compress all *.html files in parallel – 2 jobs per CPU thread in parallelparallel --jobs 200% gzip ::: *.html Convert all *.wav to *.mp3 using lame1 job per CPU thread in parallel (default)parallel lame {} -o {.}.mp3 ::: *.wav Chop bigfile into 1MB blocks and grep for the string foobarcat bigfile | parallel --pipe grep foobar Input sources parallel echo ::: cmd line input source cat input_from_stdin | parallel echo parallel echo ::: multiple input sources ::: with values parallel -a input_from_file echo parallel echo :::: input_from_file parallel echo :::: input_from_file ::: and command line Replacement string Value if input is mydir/mysubdir/myfile.myext {} mydir/mysubdir/myfile.myext {.} mydir/mysubdir/myfile {/}, {//}, {/.} myfile.myext, mydir/mysubdir, myfile {#} The sequence number of the job {%} The job slot number {2} Value from the second input source {2.} {2/} {2//} {2/.} Combination of {2} and {.} {/} {//} {/.} {= perl expression =} Change $_ with perl expression Control the output – keep the same order as the input, prepend with input value parallel --keep-order --tag "sleep {}; echo {}" ::: 5 4 3 2 1 Control the execution Run 2 jobs in parallel – command is a composed command parallel --jobs 2 "sleep {}; echo {}" ::: 5 4 3 2 1 See what will be run parallel --dryrun echo {2} {1} ::: bird flower fish ::: Red Green Blue Remote execution parallel -S server1 -S server2 "hostname; echo {}" ::: foo bar Pipe mode cat bigfile | parallel --pipe wc -l Chop bigfile into one block per CPU thread and grep for foobarparallel -a bigfile --pipepart --block -1 grep foobar Read more – Your command line will love you for it parallel --help; man parallel; man parallel_tutorial; www.pi.dk/1 GNU Parallel 2018 https://doi.org/10.5281/zenodo.1146014 (CC-By-SA) 2019-03-11 Ole Tange