coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

'tr' strange behaviors with '-t'


From: Eduardo Mezêncio
Subject: 'tr' strange behaviors with '-t'
Date: Sat, 21 Oct 2023 23:46:06 +0000

Greetings,

I would like some help to understand if some behaviors of 'tr' are bugs or just 
the intended behavior.

# First case

Consider `echo aaabcc | tr -ds bc a`:
  It outputs `a` as expected, because it deletes `b` and `c` and squeezes `aaa` 
to a single `a`.

Now consider the same command including `-t`, `echo aaabcc | tr -dst bc a`:
  The result is the same, `a`, but I expected it to be `acc`, because `bc` 
would be truncated to the lenght of `a`, resulting in `b`, so `b` should be 
deleted and `a` squeezed, resulting in `acc`

# Second case

Consider `echo aaabcc | tr -c a _`:
  It outputs `aaa___` as expected

Now the same with -t, `echo aaabcc | tr -ct a _`:
  I expected it to output the same thing, because `-t` should make no 
difference in this case, but it outputs `aaabcc`, same as the input



reply via email to

[Prev in Thread] Current Thread [Next in Thread]