In this sed command, the backslashes need to be escaped when used in shell:
bash-3.2$ echo "Hello lg:en" | sed "s/.*lg:\(.*\).*/\1/"
en
In a nextflow shell process (see below), this would result in:
ERROR ~ startup failed:
test.nf: 11: unexpected char: '\' @ line 11, column 29.
echo "!{x}" | sed "s/.*lg:\(.*\).*/\1/"
But it works when escaping the three backslashes. However, the \t in printf "This \t works" doesn't need to be escaped:
echo true
cheers = Channel.from 'Bojour lg:fr', 'Ciao lg:it', 'Hello lg:en', 'Hola lg:es', 'Γεια σου lg:gr'
process sayHello {
input:
val x from cheers
shell:
'''
echo "!{x}" | sed "s/.*lg:\\(.*\\).*/\\1/"
printf "This \t works"
'''
}
In this sed command, the backslashes need to be escaped when used in shell:
In a nextflow shell process (see below), this would result in:
But it works when escaping the three backslashes. However, the
\tinprintf "This \t works"doesn't need to be escaped: