Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #264582

Re: why would "tr --complement --squeeze-repeats ..." append the substitution char once more? ...

From Greg Wooledge <greg@wooledge.org>
Newsgroups linux.debian.user
Subject Re: why would "tr --complement --squeeze-repeats ..." append the substitution char once more? ...
Date 2023-12-11 04:40 +0100
Message-ID <HJFjb-cKvV-1@gated-at.bofh.it> (permalink)
References <HJEGt-cJY3-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Dec 11, 2023 at 02:53:07AM +0000, Albretch Mueller wrote:
> echo "abc123" > file.txt
> ftype=$(file --brief file.txt)
> echo "// __ \$ftype: |${ftype}|"
> ftypelen=${#ftype}
> echo "// __ \$ftypelen: |${ftypelen}|"
> 
> # removing spaces ...
> ftype2=$(echo "${ftype}" | tr --complement --squeeze-repeats
> '[A-Za-z0-9.]' '_');
> echo "// __ \$ftype2: |${ftype2}|"
> ftype2len=${#ftype2}
> echo "// __ \$ftype2len: |${ftype2len}|"

Please tell us:

 * What you are trying to do.

 * What you did (is the previous code all in a script?  if so, this is a
   good answer for this part).

 * What result you got.

 * What you expected to get.

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Albretch Mueller <lbrtchx@gmail.com> - 2023-12-11 04:00 +0100
  Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Greg Wooledge <greg@wooledge.org> - 2023-12-11 04:40 +0100
    Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Albretch Mueller <lbrtchx@gmail.com> - 2023-12-11 09:10 +0100
      Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... <tomas@tuxteam.de> - 2023-12-11 09:40 +0100
        Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Albretch Mueller <lbrtchx@gmail.com> - 2023-12-11 12:30 +0100
          Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... tomas@tuxteam.de - 2023-12-11 13:00 +0100
          Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Greg Wooledge <greg@wooledge.org> - 2023-12-11 13:40 +0100
        Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Greg Wooledge <greg@wooledge.org> - 2023-12-11 13:50 +0100
          Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... <tomas@tuxteam.de> - 2023-12-11 14:20 +0100
            Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Greg Wooledge <greg@wooledge.org> - 2023-12-11 14:30 +0100
              Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Albretch Mueller <lbrtchx@gmail.com> - 2023-12-11 15:10 +0100
                Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Max Nikulin <manikulin@gmail.com> - 2023-12-11 16:00 +0100
                Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Greg Wooledge <greg@wooledge.org> - 2023-12-11 16:00 +0100
                Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... <tomas@tuxteam.de> - 2023-12-11 16:10 +0100
                "echo" literally in sh scripts (was: why would "tr --complement --squeeze-repeats ..." append the substitution char once more? ...) Stefan Monnier <monnier@iro.umontreal.ca> - 2023-12-11 16:20 +0100
                Re: "echo" literally in sh scripts (was: why would "tr --complement  --squeeze-repeats ..." append the substitution char once more? ...) Greg Wooledge <greg@wooledge.org> - 2023-12-11 18:00 +0100
                Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... Albretch Mueller <lbrtchx@gmail.com> - 2023-12-11 20:00 +0100
  Re: why would "tr --complement --squeeze-repeats ..." append the  substitution char once more? ... debian-user@howorth.org.uk - 2023-12-11 19:20 +0100

csiph-web