Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Successful and fortunate crime is called virtue. -- Seneca


devel / comp.unix.shell / Re: bash: /usr/bin/sed: Argument list too long

SubjectAuthor
* bash: /usr/bin/sed: Argument list too longhongy...@gmail.com
`* Re: bash: /usr/bin/sed: Argument list too longJanis Papanagnou
 `- Re: bash: /usr/bin/sed: Argument list too longhongy...@gmail.com

1
bash: /usr/bin/sed: Argument list too long

<12bf6496-f1f8-42da-8281-6c2a63d8a7bcn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=5409&group=comp.unix.shell#5409

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:6000:1686:b0:21b:9870:47b with SMTP id y6-20020a056000168600b0021b9870047bmr9889798wrd.687.1656302359480;
Sun, 26 Jun 2022 20:59:19 -0700 (PDT)
X-Received: by 2002:a05:6870:f603:b0:101:a202:42b2 with SMTP id
ek3-20020a056870f60300b00101a20242b2mr8639531oab.221.1656302358856; Sun, 26
Jun 2022 20:59:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Sun, 26 Jun 2022 20:59:18 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=103.149.249.41; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.149.249.41
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <12bf6496-f1f8-42da-8281-6c2a63d8a7bcn@googlegroups.com>
Subject: bash: /usr/bin/sed: Argument list too long
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Mon, 27 Jun 2022 03:59:19 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Mon, 27 Jun 2022 03:59 UTC

I've two files, named as "__tmp.symbols" and "gap.tmLanguage" respectively, and they can be retrieved from here [1]. When I try to run the following sed command using these two files, an error will be triggered as follows:

$ sed -E -i "s/^(\s*<string>\\\b\().*IsGroup.*(\)\\\b<\/string>$)/\1$(cat ./__tmp.symbols)\2/g" gap.tmLanguage
bash: /usr/bin/sed: Argument list too long

Any hints for fixing it?

[1] https://github.com/hongyi-zhao/temp/tree/master/sed

Regards,
HZ

Re: bash: /usr/bin/sed: Argument list too long

<t9bfra$9p2v$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=5410&group=comp.unix.shell#5410

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: bash: /usr/bin/sed: Argument list too long
Date: Mon, 27 Jun 2022 07:39:54 +0200
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <t9bfra$9p2v$1@dont-email.me>
References: <12bf6496-f1f8-42da-8281-6c2a63d8a7bcn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Jun 2022 05:39:54 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a0e42eaea2f8840230ff26c29e3acf3a";
logging-data="320607"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lNEu36jRqQYgBx8NmGsRX"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:aOyrgB+n09g9mZJSS440Pp+PH08=
In-Reply-To: <12bf6496-f1f8-42da-8281-6c2a63d8a7bcn@googlegroups.com>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Mon, 27 Jun 2022 05:39 UTC

On 27.06.2022 05:59, hongy...@gmail.com wrote:
> I've two files, named as "__tmp.symbols" and "gap.tmLanguage" respectively, and they can be retrieved from here [1]. When I try to run the following sed command using these two files, an error will be triggered as follows:
>
> $ sed -E -i "s/^(\s*<string>\\\b\().*IsGroup.*(\)\\\b<\/string>$)/\1$(cat ./__tmp.symbols)\2/g" gap.tmLanguage
> bash: /usr/bin/sed: Argument list too long
>
> Any hints for fixing it?

Obviously the contents of file __tmp.symbols are far too many so
that $(cat ./__tmp.symbols) will expand to a too long line.

My guess is that you wanted to do something different than putting
the whole content of a file into a sed _substitution argument_?

Anyway, to fix that use a more appropriate approach, like matching
the pattern and printing the contents at the matched place. A tool
like awk (for example) will provide you with that solution.

Janis

>
> [1] https://github.com/hongyi-zhao/temp/tree/master/sed
>
> Regards,
> HZ
>

Re: bash: /usr/bin/sed: Argument list too long

<15d028b6-0778-4d56-a2b6-16f56b4fe30an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=5411&group=comp.unix.shell#5411

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:adf:e28a:0:b0:210:b31:722 with SMTP id v10-20020adfe28a000000b002100b310722mr10992138wri.65.1656316431567;
Mon, 27 Jun 2022 00:53:51 -0700 (PDT)
X-Received: by 2002:a05:6830:3188:b0:60c:12e9:8188 with SMTP id
p8-20020a056830318800b0060c12e98188mr5310972ots.72.1656316430956; Mon, 27 Jun
2022 00:53:50 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.88.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Mon, 27 Jun 2022 00:53:50 -0700 (PDT)
In-Reply-To: <t9bfra$9p2v$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=103.149.249.41; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.149.249.41
References: <12bf6496-f1f8-42da-8281-6c2a63d8a7bcn@googlegroups.com> <t9bfra$9p2v$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <15d028b6-0778-4d56-a2b6-16f56b4fe30an@googlegroups.com>
Subject: Re: bash: /usr/bin/sed: Argument list too long
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Mon, 27 Jun 2022 07:53:51 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Mon, 27 Jun 2022 07:53 UTC

On Monday, June 27, 2022 at 1:40:04 PM UTC+8, Janis Papanagnou wrote:
> On 27.06.2022 05:59, hongy...@gmail.com wrote:
> > I've two files, named as "__tmp.symbols" and "gap.tmLanguage" respectively, and they can be retrieved from here [1]. When I try to run the following sed command using these two files, an error will be triggered as follows:
> >
> > $ sed -E -i "s/^(\s*<string>\\\b\().*IsGroup.*(\)\\\b<\/string>$)/\1$(cat ./__tmp.symbols)\2/g" gap.tmLanguage
> > bash: /usr/bin/sed: Argument list too long
> >
> > Any hints for fixing it?
> Obviously the contents of file __tmp.symbols are far too many so
> that $(cat ./__tmp.symbols) will expand to a too long line.
>
> My guess is that you wanted to do something different than putting
> the whole content of a file into a sed _substitution argument_?
>
> Anyway, to fix that use a more appropriate approach, like matching
> the pattern and printing the contents at the matched place. A tool
> like awk (for example) will provide you with that solution.

Thank you for your comment. According to your analysis and advice, I came up with the following method:

$ awk 'FNR==NR { a = $0; next } match($0,/^(\s*<string>\\b\().*IsGroup.*(\)\\b<\/string>$)/,c) {print c[1] a c[2]; next } 1 ' __tmp.symbols gap.tmLanguage > gap.tmLanguage2

> Janis

Yours,
HZ

> >
> > [1] https://github.com/hongyi-zhao/temp/tree/master/sed
> >
> > Regards,
> > HZ
> >

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor