zsh-users
 help / color / mirror / code / Atom feed
* Sed error
@ 2022-08-03  0:12 Aki Hoji
  2022-08-03  0:40 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Aki Hoji @ 2022-08-03  0:12 UTC (permalink / raw)
  To: zsh-users

HI, 

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

When I run this one liner in bash, it works just fine but under zsh. Apprently, zsh does not like “!”.   Isn’t  “!” in the script not compatible with zsh and is there any work around for this ? 

I am using my institution’s cluster;

3.10.0-1160.71.1.el7.x86_64
 x86_64 x86_64 x86_64 GNU/Linu

Thanks. 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Sed error
  2022-08-03  0:12 Sed error Aki Hoji
@ 2022-08-03  0:40 ` Bart Schaefer
  2022-08-03  0:41   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2022-08-03  0:40 UTC (permalink / raw)
  To: Aki Hoji; +Cc: Zsh Users

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"'


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Sed error
  2022-08-03  0:40 ` Bart Schaefer
@ 2022-08-03  0:41   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2022-08-03  0:41 UTC (permalink / raw)
  To: Aki Hoji; +Cc: Zsh Users

On Tue, Aug 2, 2022 at 5:40 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> This might work:

After removing gmail's annoying line wrapping, that is.

> EXPR='$!N;/\nXQ@A00165/!P;D' parallel -a temp3.fq  -k --block 50M
> --pipe-part 'sed -e  "$EXPR"'


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-03  0:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03  0:12 Sed error Aki Hoji
2022-08-03  0:40 ` Bart Schaefer
2022-08-03  0:41   ` Bart Schaefer

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

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).