Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Can't open /usr/share/games/fortunes/fortunes. Lid stuck on cookie jar.


devel / comp.unix.shell / Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

SubjectAuthor
* Replace all non-printable/control characters with plain space excepthongy...@gmail.com
+* Replace all non-printable/control characters with plain spaceJanis Papanagnou
|`* Replace all non-printable/control characters with plain spacehongy...@gmail.com
| `* Replace all non-printable/control characters with plain spaceJanis Papanagnou
|  `* Replace all non-printable/control characters with plain spacehongy...@gmail.com
|   +* Replace all non-printable/control characters with plain spacehongy...@gmail.com
|   |`* Replace all non-printable/control characters with plain spaceJanis Papanagnou
|   | `- Replace all non-printable/control characters with plain spacehongy...@gmail.com
|   `* [meta] Re: Replace all non-printable/control characters with plainJanis Papanagnou
|    `- [meta] Re: Replace all non-printable/control characters withhongy...@gmail.com
`* Replace all non-printable/control characters with plain spaceJalen Q
 `- Replace all non-printable/control characters with plain spaceJalen Q

1
Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6876&group=comp.unix.shell#6876

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:6214:1872:b0:577:5ef5:4cfb with SMTP id eh18-20020a056214187200b005775ef54cfbmr7319781qvb.8.1679324423752;
Mon, 20 Mar 2023 08:00:23 -0700 (PDT)
X-Received: by 2002:a05:6808:605:b0:384:11ed:a879 with SMTP id
y5-20020a056808060500b0038411eda879mr22038oih.10.1679324423397; Mon, 20 Mar
2023 08:00:23 -0700 (PDT)
Path: rocksolid2!i2pn.org!news.swapon.de!news.uzoreto.com!peer01.ams4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Mon, 20 Mar 2023 08:00:23 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=103.149.249.7; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.149.249.7
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
Subject: Replace all non-printable/control characters with plain space except
keeping the `\n' as they are.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Mon, 20 Mar 2023 15:00:23 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1551
 by: hongy...@gmail.com - Mon, 20 Mar 2023 15:00 UTC

I want to replace all the non-printable/control characters with plain space except keeping the `\n' as they are in the following string:

```
str:="""#g2 % point group to the space group of group
3 % generator
0 -1 0
0 0 -1
-1 0 0
3 /8 % generator
-30 58 -30
-33 55 -25
-25 55 -33
% order of the group unknown""";
```

Is there a convenient way to do this?

Regards,
Zhao

Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<tva1rs$3jqhb$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6877&group=comp.unix.shell#6877

  copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Replace all non-printable/control characters with plain space
except keeping the `\n' as they are.
Date: Mon, 20 Mar 2023 17:33:00 +0100
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <tva1rs$3jqhb$1@dont-email.me>
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 20 Mar 2023 16:33:00 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="53f8e4064505948ea5329bd614f3a6ff";
logging-data="3795499"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1OmbaY2FKn0Rg8Ou8c2Kc"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:1uEzj1YVd8zYtMiup2DLlPGznJA=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
 by: Janis Papanagnou - Mon, 20 Mar 2023 16:33 UTC

On 20.03.2023 16:00, hongy...@gmail.com wrote:
> I want to replace all the non-printable/control characters with plain
> space except keeping the `\n' as they are in the following string:

I don't see any control characters in your data below.

>
> ```
> str:="""#g2 % point group to the space group of group
> 3 % generator
> 0 -1 0
> 0 0 -1
> -1 0 0
> 3 /8 % generator
> -30 58 -30
> -33 55 -25
> -25 55 -33
> % order of the group unknown""";
> ```
>
> Is there a convenient way to do this?

Of course. Use variable substitution with patterns containing
the respective character classes; for example

str="..." # any string
printf "%s" "${str//[^[:print:]$'\n']/ }"

to replace all occurrences of non-printable and also not '\n'.

Janis

>
> Regards,
> Zhao
>

Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<1b632b48-0fa3-4e18-aa63-1113af65e6c8n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6878&group=comp.unix.shell#6878

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:6214:1872:b0:56f:6b7:3a7b with SMTP id eh18-20020a056214187200b0056f06b73a7bmr131303qvb.7.1679356750460;
Mon, 20 Mar 2023 16:59:10 -0700 (PDT)
X-Received: by 2002:aca:280b:0:b0:383:f8b1:c259 with SMTP id
11-20020aca280b000000b00383f8b1c259mr83788oix.7.1679356750153; Mon, 20 Mar
2023 16:59:10 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Mon, 20 Mar 2023 16:59:09 -0700 (PDT)
In-Reply-To: <tva1rs$3jqhb$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=103.149.249.7; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.149.249.7
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com> <tva1rs$3jqhb$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1b632b48-0fa3-4e18-aa63-1113af65e6c8n@googlegroups.com>
Subject: Re: Replace all non-printable/control characters with plain space
except keeping the `\n' as they are.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Mon, 20 Mar 2023 23:59:10 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: hongy...@gmail.com - Mon, 20 Mar 2023 23:59 UTC

On Tuesday, March 21, 2023 at 12:33:06 AM UTC+8, Janis Papanagnou wrote:
> On 20.03.2023 16:00, hongy...@gmail.com wrote:
> > I want to replace all the non-printable/control characters with plain
> > space except keeping the `\n' as they are in the following string:
> I don't see any control characters in your data below.

If I first store the string here into a file named as `strfile' and then check it as follows, you will see them:

werner@X10DAi:~$ cat -A strfile
#g2 % point group to the space group of group$
3^I% generator$
0 -1 0$
0 0 -1$
-1 0 0$
3^I/8^I^I% generator$
-30 58 -30$
-33 55 -25$
-25 55 -33$
% order of the group unknown$

> >
> > ```
> > str:="""#g2 % point group to the space group of group
> > 3 % generator
> > 0 -1 0
> > 0 0 -1
> > -1 0 0
> > 3 /8 % generator
> > -30 58 -30
> > -33 55 -25
> > -25 55 -33
> > % order of the group unknown""";
> > ```
> >
> > Is there a convenient way to do this?
> Of course. Use variable substitution with patterns containing
> the respective character classes; for example
>
> str="..." # any string
> printf "%s" "${str//[^[:print:]$'\n']/ }"
>
> to replace all occurrences of non-printable and also not '\n'.

But your description above is inconsistent with the answer given by ChatGPT:

```
User:
str="..." # any string
printf "%s" "${str//[^[:print:]$'\n']/ }"

ChatGPT:
This code replaces any non-printable characters in the string "str" with a space. The "printf" command is used to print the modified string.

The "${str//[^[:print:]$'\n']/ }" part of the code is a parameter expansion that uses pattern substitution. The pattern "[^[:print:]$'\n']" matches any character that is not a printable character or a newline character. The substitution "/ " replaces each matched character with a space.

Overall, this code is useful for cleaning up strings and removing any non-printable characters that may cause issues in further processing or display.

User:
explain it in more detail

ChatGPT:
Sure, I'd be happy to explain this code in more detail!

The code you provided is a Bash script that uses the `printf` command to print a modified version of a string. The string is stored in the variable `str`, which is defined as a placeholder in the code you provided.

The `${str//pattern/replacement}` syntax is a parameter expansion that performs pattern substitution on the `str` variable. In this case, the pattern is `[^[:print:]$'\n']`, which matches any character that is not a printable character or a newline character. The `[:print:]` character class matches any printable character, which includes letters, numbers, punctuation, and whitespace. The `$'\n'` syntax is a Bash escape sequence that represents a newline character.

The replacement in this pattern substitution is a space character, denoted by the single space between the forward slashes. This means that any non-printable characters or newline characters in the `str` variable will be replaced with a space character.

The `printf` command then prints the modified string using the `%s` format specifier. This format specifier tells `printf` to print the argument as a string. The modified string is passed as an argument to `printf`, using the `${str//pattern/replacement}` syntax to substitute the modified string for the original `str` variable.

Overall, this code is a useful way to clean up strings and remove any non-printable characters or newline characters that may cause issues in further processing or display.
```

Finally, I only want to replace all occurrences of non-printable with one space and also keep '\n' as they are. The following is the desired result when applied on the file whose content is the string discussed here:

werner@X10DAi:~$ sed -e 's/[^[:print:]]/ /g' strfile | cat -A
#g2 % point group to the space group of group$
3 % generator$
0 -1 0$
0 0 -1$
-1 0 0$
3 /8 % generator$
-30 58 -30$
-33 55 -25$
-25 55 -33$
% order of the group unknown$

But my concern here is that is the whole file is represented in a string, I should do the above string operations on this string instead of a file.

> Janis
>
> >
> > Regards,
> > Zhao
> >

Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<tvb181$3p2ld$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6879&group=comp.unix.shell#6879

  copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Replace all non-printable/control characters with plain space
except keeping the `\n' as they are.
Date: Tue, 21 Mar 2023 02:28:32 +0100
Organization: A noiseless patient Spider
Lines: 96
Message-ID: <tvb181$3p2ld$1@dont-email.me>
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
<tva1rs$3jqhb$1@dont-email.me>
<1b632b48-0fa3-4e18-aa63-1113af65e6c8n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 21 Mar 2023 01:28:33 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="82572e59102e28f8a6fab9ea56e2ba0b";
logging-data="3967661"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Ct/lF/tQcThMeGCNMCigO"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:Mz5sF9dS9ofJ7mFRAnBnPoEcE44=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <1b632b48-0fa3-4e18-aa63-1113af65e6c8n@googlegroups.com>
 by: Janis Papanagnou - Tue, 21 Mar 2023 01:28 UTC

On 21.03.2023 00:59, hongy...@gmail.com wrote:
> On Tuesday, March 21, 2023 at 12:33:06 AM UTC+8, Janis Papanagnou
> wrote:
>> On 20.03.2023 16:00, hongy...@gmail.com wrote:
>>> I want to replace all the non-printable/control characters with
>>> plain space except keeping the `\n' as they are in the following
>>> string:
>> I don't see any control characters in your data below.
>
> If I first store the string here into a file named as `strfile' and
> then check it as follows, you will see them:

No. If _you_ do that *you* will see them. _I_ just see spaces tabs
and newlines as the only control characters.

>
> werner@X10DAi:~$ cat -A strfile #g2 % point group to the space group
> of group$ 3^I% generator$ 0 -1 0$ 0 0 -1$ -1 0 0$ 3^I/8^I^I%
> generator$ -30 58 -30$ -33 55 -25$ -25 55 -33$ % order of the group
> unknown$
>
>
>>>
>>> ``` str:="""#g2 % point group to the space group of group 3 %
>>> generator 0 -1 0 0 0 -1 -1 0 0 3 /8 % generator -30 58 -30 -33 55
>>> -25 -25 55 -33 % order of the group unknown"""; ```
>>>
>>> Is there a convenient way to do this?
>> Of course. Use variable substitution with patterns containing the
>> respective character classes; for example
>>
>> str="..." # any string printf "%s" "${str//[^[:print:]$'\n']/ }"
>>
>> to replace all occurrences of non-printable and also not '\n'.
>
> But your description above is inconsistent with the answer given by
> ChatGPT:

I suggest to discuss that with ChatGPT then, if you think there's
more expertise, and if you prefer chatting with that tool instead
of just trying the suggestion on your data.

[ big snip of chat protocol spam ]

>
> Overall, this code is a useful way to clean up strings and remove any
> non-printable characters or newline characters that may cause issues
> in further processing or display. ```

Are you saying that or your chat tool?

The character set [^[:print:]$'\n'] specifies a pattern defined
by the negated ('^') sets comprising printables and newlines.

That is what you said you need. No?

>
> Finally, I only want to replace all occurrences of non-printable with
> one space and also keep '\n' as they are.

Newlines are not touched with the code I presented.

You didn't say in your original post that you want multiple occurrences
"compressed" to a single character replacement.

To transform _multiple_ consecutive control characters by a _single_
character adjust your regexp. Depending on what tool (what shell type,
sed, whatever) you want to use it's either
[^[:print:]$'\n']+
[^[:print:]$'\n'][^[:print:]$'\n']*
+([^[:print:]$'\n'])

> The following is the
> desired result when applied on the file whose content is the string
> discussed here:
>
> werner@X10DAi:~$ sed -e 's/[^[:print:]]/ /g' strfile | cat -A #g2 %
> point group to the space group of group$ 3 % generator$ 0 -1 0$ 0 0
> -1$ -1 0 0$ 3 /8 % generator$ -30 58 -30$ -33 55 -25$ -25 55 -33$
> % order of the group unknown$
>
> But my concern here is that is the whole file is represented in a
> string, I should do the above string operations on this string
> instead of a file.

That's what the shell's string substitution ${str//.../...} is for.

In other words, just apply the solution, or go chatting with ChatGPT.

>
>> Janis
>>
>>>
>>> Regards, Zhao
>>>

Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<e06ac572-c83b-45ba-ab47-9352d2bcae0dn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6880&group=comp.unix.shell#6880

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:622a:1a28:b0:3de:4f0e:677d with SMTP id f40-20020a05622a1a2800b003de4f0e677dmr690043qtb.7.1679380540831;
Mon, 20 Mar 2023 23:35:40 -0700 (PDT)
X-Received: by 2002:a05:6871:4bc9:b0:17e:7304:6a7b with SMTP id
ud9-20020a0568714bc900b0017e73046a7bmr107671oab.5.1679380540461; Mon, 20 Mar
2023 23:35:40 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Mon, 20 Mar 2023 23:35:40 -0700 (PDT)
In-Reply-To: <tvb181$3p2ld$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=103.149.249.7; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.149.249.7
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
<tva1rs$3jqhb$1@dont-email.me> <1b632b48-0fa3-4e18-aa63-1113af65e6c8n@googlegroups.com>
<tvb181$3p2ld$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e06ac572-c83b-45ba-ab47-9352d2bcae0dn@googlegroups.com>
Subject: Re: Replace all non-printable/control characters with plain space
except keeping the `\n' as they are.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Tue, 21 Mar 2023 06:35:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 137
 by: hongy...@gmail.com - Tue, 21 Mar 2023 06:35 UTC

On Tuesday, March 21, 2023 at 9:28:39 AM UTC+8, Janis Papanagnou wrote:
> On 21.03.2023 00:59, hongy...@gmail.com wrote:
> > On Tuesday, March 21, 2023 at 12:33:06 AM UTC+8, Janis Papanagnou
> > wrote:
> >> On 20.03.2023 16:00, hongy...@gmail.com wrote:
> >>> I want to replace all the non-printable/control characters with
> >>> plain space except keeping the `\n' as they are in the following
> >>> string:
> >> I don't see any control characters in your data below.
> >
> > If I first store the string here into a file named as `strfile' and
> > then check it as follows, you will see them:
> No. If _you_ do that *you* will see them. _I_ just see spaces tabs
> and newlines as the only control characters.
> >
> > werner@X10DAi:~$ cat -A strfile #g2 % point group to the space group
> > of group$ 3^I% generator$ 0 -1 0$ 0 0 -1$ -1 0 0$ 3^I/8^I^I%
> > generator$ -30 58 -30$ -33 55 -25$ -25 55 -33$ % order of the group
> > unknown$
> >
> >
> >>>
> >>> ``` str:="""#g2 % point group to the space group of group 3 %
> >>> generator 0 -1 0 0 0 -1 -1 0 0 3 /8 % generator -30 58 -30 -33 55
> >>> -25 -25 55 -33 % order of the group unknown"""; ```
> >>>
> >>> Is there a convenient way to do this?
> >> Of course. Use variable substitution with patterns containing the
> >> respective character classes; for example
> >>
> >> str="..." # any string printf "%s" "${str//[^[:print:]$'\n']/ }"
> >>
> >> to replace all occurrences of non-printable and also not '\n'.
> >
> > But your description above is inconsistent with the answer given by
> > ChatGPT:
> I suggest to discuss that with ChatGPT then, if you think there's
> more expertise, and if you prefer chatting with that tool instead
> of just trying the suggestion on your data.

In fact, in the analysis of your regex, ChatGPT is indeed correct. However, its final summary is wrong:

The replacement in this pattern substitution is a space character, denoted by the single space between the forward slashes. This means that any non-printable characters or newline characters in the `str` variable will be replaced with a space character.

"any non-printable characters or newline characters" should be "any non-printable characters other than newline characters".
> [ big snip of chat protocol spam ]
> >
> > Overall, this code is a useful way to clean up strings and remove any
> > non-printable characters or newline characters that may cause issues
> > in further processing or display. ```
> Are you saying that or your chat tool?
>
> The character set [^[:print:]$'\n'] specifies a pattern defined
> by the negated ('^') sets comprising printables and newlines.
>
> That is what you said you need. No?

Yes.

> >
> > Finally, I only want to replace all occurrences of non-printable with
> > one space and also keep '\n' as they are.
> Newlines are not touched with the code I presented.
>
> You didn't say in your original post that you want multiple occurrences
> "compressed" to a single character replacement.
>
> To transform _multiple_ consecutive control characters by a _single_
> character adjust your regexp. Depending on what tool (what shell type,
> sed, whatever) you want to use it's either
> [^[:print:]$'\n']+
> [^[:print:]$'\n'][^[:print:]$'\n']*
> +([^[:print:]$'\n'])

They all work as follows, with `grep -E':

werner@X10DAi:~$ grep -E '[^[:print:]$'\n']+' strfile | cat -A
3^I% generator$
3^I/8^I^I% generator$
werner@X10DAi:~$ grep -E '[^[:print:]$'\n'][^[:print:]$'\n']*' strfile | cat -A
3^I% generator$
3^I/8^I^I% generator$
werner@X10DAi:~$ grep -E '[^[:print:]$'\n']+' strfile | cat -A
3^I% generator$
3^I/8^I^I% generator$

> > The following is the
> > desired result when applied on the file whose content is the string
> > discussed here:
> >
> > werner@X10DAi:~$ sed -e 's/[^[:print:]]/ /g' strfile | cat -A #g2 %
> > point group to the space group of group$ 3 % generator$ 0 -1 0$ 0 0
> > -1$ -1 0 0$ 3 /8 % generator$ -30 58 -30$ -33 55 -25$ -25 55 -33$
> > % order of the group unknown$
> >
> > But my concern here is that is the whole file is represented in a
> > string, I should do the above string operations on this string
> > instead of a file.
> That's what the shell's string substitution ${str//.../...} is for.

In my example, the more portable usage should be as follows:
werner@X10DAi:~$ sed -Ee 's/[^[:print:]]/ /g' strfile | cat -A
#g2 % point group to the space group of group$
3 % generator$
0 -1 0$
0 0 -1$
-1 0 0$
3 /8 % generator$
-30 58 -30$
-33 55 -25$
-25 55 -33$
% order of the group unknown$

> In other words, just apply the solution, or go chatting with ChatGPT.

Agreed. But isn't it better to combine the advantages of both to a certain extent?

Zhao
> >
> >> Janis
> >>
> >>>
> >>> Regards, Zhao
> >>>

Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<b811a5bf-a3dd-4591-a2c4-b5bef7bd0800n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6881&group=comp.unix.shell#6881

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:622a:2cc:b0:3bf:db2a:6a22 with SMTP id a12-20020a05622a02cc00b003bfdb2a6a22mr1007294qtx.12.1679406400405;
Tue, 21 Mar 2023 06:46:40 -0700 (PDT)
X-Received: by 2002:a05:6871:8891:b0:17e:3201:41b0 with SMTP id
tg17-20020a056871889100b0017e320141b0mr663593oab.5.1679406400055; Tue, 21 Mar
2023 06:46:40 -0700 (PDT)
Path: rocksolid2!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Tue, 21 Mar 2023 06:46:39 -0700 (PDT)
In-Reply-To: <e06ac572-c83b-45ba-ab47-9352d2bcae0dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=208.86.32.27; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 208.86.32.27
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
<tva1rs$3jqhb$1@dont-email.me> <1b632b48-0fa3-4e18-aa63-1113af65e6c8n@googlegroups.com>
<tvb181$3p2ld$1@dont-email.me> <e06ac572-c83b-45ba-ab47-9352d2bcae0dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b811a5bf-a3dd-4591-a2c4-b5bef7bd0800n@googlegroups.com>
Subject: Re: Replace all non-printable/control characters with plain space
except keeping the `\n' as they are.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Tue, 21 Mar 2023 13:46:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 7055
 by: hongy...@gmail.com - Tue, 21 Mar 2023 13:46 UTC

On Tuesday, March 21, 2023 at 2:35:43 PM UTC+8, hongy...@gmail.com wrote:
> On Tuesday, March 21, 2023 at 9:28:39 AM UTC+8, Janis Papanagnou wrote:
> > On 21.03.2023 00:59, hongy...@gmail.com wrote:
> > > On Tuesday, March 21, 2023 at 12:33:06 AM UTC+8, Janis Papanagnou
> > > wrote:
> > >> On 20.03.2023 16:00, hongy...@gmail.com wrote:
> > >>> I want to replace all the non-printable/control characters with
> > >>> plain space except keeping the `\n' as they are in the following
> > >>> string:
> > >> I don't see any control characters in your data below.
> > >
> > > If I first store the string here into a file named as `strfile' and
> > > then check it as follows, you will see them:
> > No. If _you_ do that *you* will see them. _I_ just see spaces tabs
> > and newlines as the only control characters.
> > >
> > > werner@X10DAi:~$ cat -A strfile #g2 % point group to the space group
> > > of group$ 3^I% generator$ 0 -1 0$ 0 0 -1$ -1 0 0$ 3^I/8^I^I%
> > > generator$ -30 58 -30$ -33 55 -25$ -25 55 -33$ % order of the group
> > > unknown$
> > >
> > >
> > >>>
> > >>> ``` str:="""#g2 % point group to the space group of group 3 %
> > >>> generator 0 -1 0 0 0 -1 -1 0 0 3 /8 % generator -30 58 -30 -33 55
> > >>> -25 -25 55 -33 % order of the group unknown"""; ```
> > >>>
> > >>> Is there a convenient way to do this?
> > >> Of course. Use variable substitution with patterns containing the
> > >> respective character classes; for example
> > >>
> > >> str="..." # any string printf "%s" "${str//[^[:print:]$'\n']/ }"
> > >>
> > >> to replace all occurrences of non-printable and also not '\n'.
> > >
> > > But your description above is inconsistent with the answer given by
> > > ChatGPT:
> > I suggest to discuss that with ChatGPT then, if you think there's
> > more expertise, and if you prefer chatting with that tool instead
> > of just trying the suggestion on your data.
> In fact, in the analysis of your regex, ChatGPT is indeed correct. However, its final summary is wrong:
> The replacement in this pattern substitution is a space character, denoted by the single space between the forward slashes. This means that any non-printable characters or newline characters in the `str` variable will be replaced with a space character.
> "any non-printable characters or newline characters" should be "any non-printable characters other than newline characters".
> > [ big snip of chat protocol spam ]
> > >
> > > Overall, this code is a useful way to clean up strings and remove any
> > > non-printable characters or newline characters that may cause issues
> > > in further processing or display. ```
> > Are you saying that or your chat tool?
> >
> > The character set [^[:print:]$'\n'] specifies a pattern defined
> > by the negated ('^') sets comprising printables and newlines.
> >
> > That is what you said you need. No?
> Yes.
> > >
> > > Finally, I only want to replace all occurrences of non-printable with
> > > one space and also keep '\n' as they are.
> > Newlines are not touched with the code I presented.
> >
> > You didn't say in your original post that you want multiple occurrences
> > "compressed" to a single character replacement.
> >
> > To transform _multiple_ consecutive control characters by a _single_
> > character adjust your regexp. Depending on what tool (what shell type,
> > sed, whatever) you want to use it's either
> > [^[:print:]$'\n']+
> > [^[:print:]$'\n'][^[:print:]$'\n']*
> > +([^[:print:]$'\n'])
> They all work as follows, with `grep -E':
>
> werner@X10DAi:~$ grep -E '[^[:print:]$'\n']+' strfile | cat -A
> 3^I% generator$
> 3^I/8^I^I% generator$
> werner@X10DAi:~$ grep -E '[^[:print:]$'\n'][^[:print:]$'\n']*' strfile | cat -A
> 3^I% generator$
> 3^I/8^I^I% generator$
> werner@X10DAi:~$ grep -E '[^[:print:]$'\n']+' strfile | cat -A
> 3^I% generator$
> 3^I/8^I^I% generator$

Another question:

[[:^print:]] and [^[:print:]], can they both be used here?

> > > The following is the
> > > desired result when applied on the file whose content is the string
> > > discussed here:
> > >
> > > werner@X10DAi:~$ sed -e 's/[^[:print:]]/ /g' strfile | cat -A #g2 %
> > > point group to the space group of group$ 3 % generator$ 0 -1 0$ 0 0
> > > -1$ -1 0 0$ 3 /8 % generator$ -30 58 -30$ -33 55 -25$ -25 55 -33$
> > > % order of the group unknown$
> > >
> > > But my concern here is that is the whole file is represented in a
> > > string, I should do the above string operations on this string
> > > instead of a file.
> > That's what the shell's string substitution ${str//.../...} is for.
> In my example, the more portable usage should be as follows:
>
> werner@X10DAi:~$ sed -Ee 's/[^[:print:]]/ /g' strfile | cat -A
> #g2 % point group to the space group of group$
> 3 % generator$
> 0 -1 0$
> 0 0 -1$
> -1 0 0$
> 3 /8 % generator$
> -30 58 -30$
> -33 55 -25$
> -25 55 -33$
> % order of the group unknown$
> > In other words, just apply the solution, or go chatting with ChatGPT.
> Agreed. But isn't it better to combine the advantages of both to a certain extent?
>
> Zhao
> > >
> > >> Janis
> > >>
> > >>>
> > >>> Regards, Zhao
> > >>>

[meta] Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<tvdl5e$bhjs$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6882&group=comp.unix.shell#6882

  copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: [meta] Re: Replace all non-printable/control characters with plain
space except keeping the `\n' as they are.
Date: Wed, 22 Mar 2023 02:20:46 +0100
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <tvdl5e$bhjs$1@dont-email.me>
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
<tva1rs$3jqhb$1@dont-email.me>
<1b632b48-0fa3-4e18-aa63-1113af65e6c8n@googlegroups.com>
<tvb181$3p2ld$1@dont-email.me>
<e06ac572-c83b-45ba-ab47-9352d2bcae0dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 22 Mar 2023 01:20:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="464425da9afa4a522d0d9b4a758452fc";
logging-data="378492"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/L1diXeXdkJm9qju+6X72U"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:GP39mLN4IkXqzhLSyh93Wg1g9Wg=
In-Reply-To: <e06ac572-c83b-45ba-ab47-9352d2bcae0dn@googlegroups.com>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Wed, 22 Mar 2023 01:20 UTC

On 21.03.2023 07:35, hongy...@gmail.com wrote:
> On Tuesday, March 21, 2023 at 9:28:39 AM UTC+8, Janis Papanagnou wrote:
>> On 21.03.2023 00:59, hongy...@gmail.com wrote:
>
>> In other words, just apply the solution, or go chatting with ChatGPT.
>
> Agreed. But isn't it better to combine the advantages of both to a certain extent?

You should be aware what ChatGPT is, how it basically works. It is not
an all-knowing deity or somesuch technical counterpart. And this group
is not about discussions whether some "conclusion" of some chat tool
is ("by accident") correct or not; for that speak with the developers
and promoters of that tool.

Generally, on your posting habits here there's certainly a lot to say.
In case you appreciate the support you get here I suggest to at least
invest in the quality of your questions and your responses. If you get
hints, e.g., to consult the man page don't post that man page content
to show us that you've read it; that's noise - folks here either know
what there's in the man pages or they know how they can call them. The
chat protocol logs are in that respect also noise (see above). Usually
there's rarely one who cares what their output is if they know how that
information is actually generated. And any bugs in the database of any
tool (whether chatGPT or else) or any buggy generation process is just
OT here.

If you understood that I can try to address your question above...
Make use of their respective advantages. But don't mix responsibilities
(if you now understand what I mean). Use information from these sources
and make your mind. Compare sources. Experiment. Judge. For yourself,
primarily. If you think you have something precious or worthwhile to
contribute to this group then do it. But don't expect that the insights
you've personally got are of any interest, even if they don't fail the
on-topic test.

Just a few suggestions and things to ponder about. Feel free to ignore
them.

Janis

Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<tvdm16$blh3$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6883&group=comp.unix.shell#6883

  copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Replace all non-printable/control characters with plain space
except keeping the `\n' as they are.
Date: Wed, 22 Mar 2023 02:35:34 +0100
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <tvdm16$blh3$1@dont-email.me>
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
<tva1rs$3jqhb$1@dont-email.me>
<1b632b48-0fa3-4e18-aa63-1113af65e6c8n@googlegroups.com>
<tvb181$3p2ld$1@dont-email.me>
<e06ac572-c83b-45ba-ab47-9352d2bcae0dn@googlegroups.com>
<b811a5bf-a3dd-4591-a2c4-b5bef7bd0800n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 22 Mar 2023 01:35:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="464425da9afa4a522d0d9b4a758452fc";
logging-data="382499"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fDI2IblFGUzhtBsk1ymsf"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:wYj01dnU5Zx4FiNFPEigIO0ATM0=
In-Reply-To: <b811a5bf-a3dd-4591-a2c4-b5bef7bd0800n@googlegroups.com>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Wed, 22 Mar 2023 01:35 UTC

[ please snip the 140 lines of previous context if all you have is a
simple question ]

On 21.03.2023 14:46, hongy...@gmail.com wrote:
>
> Another question:
>
> [[:^print:]] and [^[:print:]], can they both be used here?

If you mean whether they are interchangeable, then No.
(Where did you get _that idea_ from, from charGPT ?)
But this you could also have easily testes yourself.

Here's some basics for your convenience...

[...] defines a character set ...
[^...] defines the complement of the character set ...
[:...:] defines a (predefined) character class ...

The latter can take the position of any character in a character set,
say, [:lower:], [:upper:], or [:digit:] may be in a character set as
in (for example)

[[:lower:][:digit:]]

(to match any lowercase character or character representing a digit)
and as

[^a-z0-9]

matches the complement also

[^[:lower:][:digit:]]

matches that complement.

This is very basic and you should inspect some contemporary source
describing the Unix'y form of regular expressions and their syntax.

Janis

Re: [meta] Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<8f9f09cd-31f3-456b-b553-8366b7f22326n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6884&group=comp.unix.shell#6884

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:622a:14a:b0:3d4:63fa:3db4 with SMTP id v10-20020a05622a014a00b003d463fa3db4mr327716qtw.5.1679452964319;
Tue, 21 Mar 2023 19:42:44 -0700 (PDT)
X-Received: by 2002:a05:6871:4d12:b0:17b:7376:8c7d with SMTP id
ug18-20020a0568714d1200b0017b73768c7dmr404624oab.1.1679452964026; Tue, 21 Mar
2023 19:42:44 -0700 (PDT)
Path: rocksolid2!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Tue, 21 Mar 2023 19:42:43 -0700 (PDT)
In-Reply-To: <tvdl5e$bhjs$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=60.249.28.128; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 60.249.28.128
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
<tva1rs$3jqhb$1@dont-email.me> <1b632b48-0fa3-4e18-aa63-1113af65e6c8n@googlegroups.com>
<tvb181$3p2ld$1@dont-email.me> <e06ac572-c83b-45ba-ab47-9352d2bcae0dn@googlegroups.com>
<tvdl5e$bhjs$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8f9f09cd-31f3-456b-b553-8366b7f22326n@googlegroups.com>
Subject: Re: [meta] Re: Replace all non-printable/control characters with
plain space except keeping the `\n' as they are.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Wed, 22 Mar 2023 02:42:44 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1717
 by: hongy...@gmail.com - Wed, 22 Mar 2023 02:42 UTC

On Wednesday, March 22, 2023 at 9:20:52 AM UTC+8, Janis Papanagnou wrote:
> [...]
> Just a few suggestions and things to ponder about. Feel free to ignore
> them.

Thank you very much for your helpful comments and suggestions!
> Janis

Zhao

Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<3447aafb-fabb-4ad4-8cf5-bb2549eb8c44n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6885&group=comp.unix.shell#6885

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:622a:18aa:b0:3e0:dee4:c925 with SMTP id v42-20020a05622a18aa00b003e0dee4c925mr846477qtc.5.1679453344956;
Tue, 21 Mar 2023 19:49:04 -0700 (PDT)
X-Received: by 2002:a05:6871:2501:b0:17e:69a2:916c with SMTP id
yx1-20020a056871250100b0017e69a2916cmr419052oab.6.1679453344711; Tue, 21 Mar
2023 19:49:04 -0700 (PDT)
Path: rocksolid2!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Tue, 21 Mar 2023 19:49:04 -0700 (PDT)
In-Reply-To: <tvdm16$blh3$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=60.249.28.128; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 60.249.28.128
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
<tva1rs$3jqhb$1@dont-email.me> <1b632b48-0fa3-4e18-aa63-1113af65e6c8n@googlegroups.com>
<tvb181$3p2ld$1@dont-email.me> <e06ac572-c83b-45ba-ab47-9352d2bcae0dn@googlegroups.com>
<b811a5bf-a3dd-4591-a2c4-b5bef7bd0800n@googlegroups.com> <tvdm16$blh3$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3447aafb-fabb-4ad4-8cf5-bb2549eb8c44n@googlegroups.com>
Subject: Re: Replace all non-printable/control characters with plain space
except keeping the `\n' as they are.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Wed, 22 Mar 2023 02:49:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2458
 by: hongy...@gmail.com - Wed, 22 Mar 2023 02:49 UTC

On Wednesday, March 22, 2023 at 9:35:40 AM UTC+8, Janis Papanagnou wrote:
> [ please snip the 140 lines of previous context if all you have is a
> simple question ]
> On 21.03.2023 14:46, hongy...@gmail.com wrote:
> >
> > Another question:
> >
> > [[:^print:]] and [^[:print:]], can they both be used here?
> If you mean whether they are interchangeable, then No.
> (Where did you get _that idea_ from, from charGPT ?)

It's really given by ChatGPT, but subsequently, it also showed that this is a non-existent pattern that was arbitrarily fabricated and rejected its correctness.

> But this you could also have easily testes yourself.

I've also checked it.

> This is very basic and you should inspect some contemporary source
> describing the Unix'y form of regular expressions and their syntax.

Thank you for telling me the correct route and method in tackling problems.
> Janis

Zhao

Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<0950561d-9c97-4306-8b85-ec5a8663865bn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6891&group=comp.unix.shell#6891

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:ad4:5a14:0:b0:56f:378:951 with SMTP id ei20-20020ad45a14000000b0056f03780951mr3061708qvb.1.1680403312939;
Sat, 01 Apr 2023 19:41:52 -0700 (PDT)
X-Received: by 2002:a9d:65d4:0:b0:690:eb8c:bae0 with SMTP id
z20-20020a9d65d4000000b00690eb8cbae0mr9936686oth.6.1680403312727; Sat, 01 Apr
2023 19:41:52 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Sat, 1 Apr 2023 19:41:52 -0700 (PDT)
In-Reply-To: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:e82:d400:f0cd:3e94:3be2:6c56;
posting-account=rR5tnAoAAAC2kIBHWh0n6frMCTGowyvE
NNTP-Posting-Host: 2600:1700:e82:d400:f0cd:3e94:3be2:6c56
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0950561d-9c97-4306-8b85-ec5a8663865bn@googlegroups.com>
Subject: Re: Replace all non-printable/control characters with plain space
except keeping the `\n' as they are.
From: jalenq81@gmail.com (Jalen Q)
Injection-Date: Sun, 02 Apr 2023 02:41:52 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 22
 by: Jalen Q - Sun, 2 Apr 2023 02:41 UTC

On Monday, March 20, 2023 at 10:00:32 AM UTC-5, hongy...@gmail.com wrote:
> I want to replace all the non-printable/control characters with plain space except keeping the `\n' as they are in the following string:
>
> ```
> str:="""#g2 % point group to the space group of group
> 3 % generator
> 0 -1 0
> 0 0 -1
> -1 0 0
> 3 /8 % generator
> -30 58 -30
> -33 55 -25
> -25 55 -33
> % order of the group unknown""";
> ```
>
> Is there a convenient way to do this?
>
> Regards,
> Zhao
bdddddccd

Re: Replace all non-printable/control characters with plain space except keeping the `\n' as they are.

<56b14190-fbc4-4a44-95eb-9b32ca8ad9bbn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6919&group=comp.unix.shell#6919

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:620a:190a:b0:71f:b8ba:ff4c with SMTP id bj10-20020a05620a190a00b0071fb8baff4cmr828757qkb.10.1680679032034;
Wed, 05 Apr 2023 00:17:12 -0700 (PDT)
X-Received: by 2002:a05:6871:7a3:b0:177:b9c0:bcba with SMTP id
o35-20020a05687107a300b00177b9c0bcbamr767332oap.3.1680679031802; Wed, 05 Apr
2023 00:17:11 -0700 (PDT)
Path: rocksolid2!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Wed, 5 Apr 2023 00:17:11 -0700 (PDT)
In-Reply-To: <0950561d-9c97-4306-8b85-ec5a8663865bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:e82:d400:107f:a7d7:29c7:8889;
posting-account=rR5tnAoAAAC2kIBHWh0n6frMCTGowyvE
NNTP-Posting-Host: 2600:1700:e82:d400:107f:a7d7:29c7:8889
References: <9f209b3d-47f6-4dd2-94bf-5b396f16701an@googlegroups.com> <0950561d-9c97-4306-8b85-ec5a8663865bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <56b14190-fbc4-4a44-95eb-9b32ca8ad9bbn@googlegroups.com>
Subject: Re: Replace all non-printable/control characters with plain space
except keeping the `\n' as they are.
From: jalenq81@gmail.com (Jalen Q)
Injection-Date: Wed, 05 Apr 2023 07:17:12 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2041
 by: Jalen Q - Wed, 5 Apr 2023 07:17 UTC

On Saturday, April 1, 2023 at 9:41:55 PM UTC-5, Jalen Q wrote:
> On Monday, March 20, 2023 at 10:00:32 AM UTC-5, hongy...@gmail.com wrote:
> > I want to replace all the non-printable/control characters with plain space except keeping the `\n' as they are in the following string:
> >
> > ```
> > str:="""#g2 % point group to the space group of group
> > 3 % generator
> > 0 -1 0
> > 0 0 -1
> > -1 0 0
> > 3 /8 % generator
> > -30 58 -30
> > -33 55 -25
> > -25 55 -33
> > % order of the group unknown""";
> > ```
> >
> > Is there a convenient way to do this?
> >
> > Regards,
> > Zhao
> bdddddccd

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor