使用 gnu-parallel 处理文件内容
Process file contents with gnu-parallel
我有一个文件,内容如下:
/path/to/file1
/path/to/file2
/path/to/file3
/path/to/file4
我想 运行 使用 gnu-parallel
实用程序在每一行并行执行一个命令,我知道它支持使用 ::::
的文件输入。我不确定的是我应该将哪些参数传递给 gnu-parallel 以将文件内容拆分为 \n
并并行处理?
这里是man parallel
:
NAME
parallel - build and execute shell command lines from
standard input in parallel
SYNOPSIS
parallel [options] [command [arguments]] < list_of_arguments
[...]
下面是这种调用形式的示例:
$ cat mylist.txt
/path/to/file1
/path/to/file2
/path/to/file3
/path/to/file4
$ parallel 'echo "I am processing:" {}' < mylist.txt
I am processing: /path/to/file1
I am processing: /path/to/file2
I am processing: /path/to/file3
I am processing: /path/to/file4
我有一个文件,内容如下:
/path/to/file1
/path/to/file2
/path/to/file3
/path/to/file4
我想 运行 使用 gnu-parallel
实用程序在每一行并行执行一个命令,我知道它支持使用 ::::
的文件输入。我不确定的是我应该将哪些参数传递给 gnu-parallel 以将文件内容拆分为 \n
并并行处理?
这里是man parallel
:
NAME
parallel - build and execute shell command lines from
standard input in parallel
SYNOPSIS
parallel [options] [command [arguments]] < list_of_arguments
[...]
下面是这种调用形式的示例:
$ cat mylist.txt
/path/to/file1
/path/to/file2
/path/to/file3
/path/to/file4
$ parallel 'echo "I am processing:" {}' < mylist.txt
I am processing: /path/to/file1
I am processing: /path/to/file2
I am processing: /path/to/file3
I am processing: /path/to/file4