Parallel processing 使用从文件中读取的两个参数启动命令(phantomjs)

Parallel processing 使用从文件中读取的两个参数启动命令(phantomjs),parallel-processing,phantomjs,gnu-parallel,Parallel Processing,Phantomjs,Gnu Parallel,我有一个文件,每行包含两个字符串,这两个字符串是从shell启动命令(phantomjs)的两个参数。我将使用gnupallel为每一行启动命令。现在,如果我手动启动,我会写: ./phantomjs rasterize.js http://www.google.it/ google.png 一切正常。但如果我尝试使用parallel,就会出现问题: parallel --verbose -a myfile --no-run-if-empty ./phantomjs rasterize.js

我有一个文件,每行包含两个字符串,这两个字符串是从shell启动命令(phantomjs)的两个参数。我将使用gnupallel为每一行启动命令。现在,如果我手动启动,我会写:

./phantomjs rasterize.js http://www.google.it/ google.png
一切正常。但如果我尝试使用parallel,就会出现问题:

parallel --verbose -a myfile --no-run-if-empty ./phantomjs rasterize.js
这是输出

./phantomjs rasterize.js http://www.google.it/\ google.png
./phantomjs rasterize.js http://www.anothersite.it/\ pic.png
Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]
  paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"
Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]
  paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"
我不明白为什么它不工作,为什么在详细模式下(前两行)链接后有
\
字符

cat-vet输出:

http://www.google.it/ google.png$
http://www.anothersite.it/ pic.png$
$
$

你已经非常接近答案了,
为什么在详细模式下(前两行)链接后有“\”字符?

GNU Parallel将每一行视为一个参数,并将引用任何特殊字符(如空格)。这就是你看到的。这是一个特性,而不是一个bug。这意味着,无论你在一行上放什么,它都会被正确引用,以便在shell中使用

但您不希望出现默认行为。您希望GNU Parallel将该行拆分为2个参数。您的列分隔符是空格:

parallel --verbose -a myfile --colsep ' ' --no-run-if-empty ./phantomjs rasterize.js

使用这些长路径进行调试非常困难,请尝试将它们符号化
ln-s./phantomjs-1.9.7-linux-i686/bin/phantomjs phantomjs
以及
ln-s phantomjs-1.9.7-linux-i686/examples/rasterize.js
编辑。现在路径变小了你的文件中有一些奇怪的字符吗?您能否运行
cat-vet myfile
并将输出粘贴到您的问题中?粘贴。但里面似乎没有奇怪的人物