Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Sed error
On Tue, Aug 2, 2022 at 5:12 PM Aki Hoji <akhst7@xxxxxxxxx> wrote:
>
> I get the error message (sed: -e expression #1, char 2: invalid usage of line address 0) when I run a following;
>
> parallel -a temp3.fq -k --block 50M --pipe-part 'sed -e "$!N;/\nXQ@A00165/!P;D"' > temp4.fq
$! is the PID of the last background job. That's being expanded to 0
because the argument to -e is in double quotes, resulting in an
expression starting with "0N;"
In bash, $! expands to the empty string when there are no background
jobs, rather than to zero. In that case the expression starts with
"N;" which is also probably not what you meant, but isn't a sed error.
You need to quote the expression so that the $! is not expanded. This
might work:
EXPR='$!N;/\nXQ@A00165/!P;D' parallel -a temp3.fq -k --block 50M
--pipe-part 'sed -e "$EXPR"'
Messages sorted by:
Reverse Date,
Date,
Thread,
Author