help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Aki Hoji <akhst7@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Sed error
Date: Tue, 2 Aug 2022 17:40:35 -0700	[thread overview]
Message-ID: <CAH+w=7abq5pWundn-G_XZu-5bKCjfVz0YP0weDk5=VVNBE=qMw@mail.gmail.com> (raw)
In-Reply-To: <39BA2F80-DBD0-4626-A57D-58109078CFD5@gmail.com>

On Tue, Aug 2, 2022 at 5:12 PM Aki Hoji <akhst7@gmail.com> 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"'

  reply	other threads:[~2022-08-03  0:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03  0:12 Aki Hoji
2022-08-03  0:40 ` Bart Schaefer [this message]
2022-08-03  0:41   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7abq5pWundn-G_XZu-5bKCjfVz0YP0weDk5=VVNBE=qMw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=akhst7@gmail.com \
    --cc=zsh-users@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).