Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why some GNU parallel input include quotes?

Gnu parallel input (e.g. from a pipe) automatically single quotes input that contains space or symbols like / and : Is there a reason for that? How can I print the input as it is without any quote?

I tried with various parallel options like -q or with different type of quotes to embed the input in the parallel command, however, it always shows up with single quotes when the input contains space of / symbols.

Here are the command lines I tried:

awk '{print "ftp://"$1}' assembly2contig.lst | parallel --dry-run wget '{}'

Output will be

wget 'ftp://mypath'
awk '{print $1}' assembly2contig.lst | parallel --dry-run wget 'ftp://{}'

This command works but I need to build my path within parallel which is not very convenient for my cases, e.g. when my input file already contains paths.

I would like to obtain

wget ftp://mypath

using ftp://mypath as parallel input coming from the pipe (e.g. awk)

like image 329
Guilhem Faure Avatar asked Aug 26 '26 07:08

Guilhem Faure


1 Answers

The reason for the quoting is to avoid the default behaviour in xargs:

echo 'two  spaces  lost' | xargs echo
echo 'two  spaces  kept' | parallel echo

To avoid this you can use eval:

echo 'two  spaces  lost' | parallel eval echo
like image 115
Ole Tange Avatar answered Aug 30 '26 10:08

Ole Tange



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!