What do the dots in this tr command do: tr …A-Z A-ZA-Z <<< “JVPQBOV” (with 13 dots)what is the...

Can a planet have a different gravitational pull depending on its location in orbit around its sun?

Latin words with no plurals in English

Uplifted animals have parts of their "brain" in various locations of their body. Where?

Piano - What is the notation for a double stop where both notes in the double stop are different lengths?

How many letters suffice to construct words with no repetition?

Why is my log file so massive? 22gb. I am running log backups

Domain expired, GoDaddy holds it and is asking more money

Is there a familial term for apples and pears?

Finding files for which a command fails

Check if two datetimes are between two others

Why do we use polarized capacitors?

Does the average primeness of natural numbers tend to zero?

What is the command to reset a PC without deleting any files

Why doesn't a const reference extend the life of a temporary object passed via a function?

Copycat chess is back

What's the difference between repeating elections every few years and repeating a referendum after a few years?

Einstein metrics on spheres

Where to refill my bottle in India?

How to move the player while also allowing forces to affect it

Are white and non-white police officers equally likely to kill black suspects?

Is there a way to make member function NOT callable from constructor?

What to wear for invited talk in Canada

Are objects structures and/or vice versa?

Email Account under attack (really) - anything I can do?



What do the dots in this tr command do: tr …A-Z A-ZA-Z


what is the benefit of --squeeze-repeats in tr commandWhy can't tr read from /dev/urandom on OSX?broken pipe error with popen and JS ffiIs the historical Unix V5 tr command padding behavior of set2 different from what we consider today “classic” System V (1983-1988) behavior?Heirloom Toolchest tr: error(s) trying to delete the complement of a set containing a multibyte character?how to substitute minus sign with trPulling IP address from ping command with sed?Why does tr -sc 'A-Za-z' '[12*]' includes empty line?I cannot understand what -c parameter does in tr command in Ubuntu GNU/Linux even though I read the manualStrange behaviour of tr using ranges






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







16















I want to use tr to do some rot13 transformation. I can beautifully understand this command:



tr A-Za-z N-ZA-Mn-za-m <<< "URYC ZR CYRNFR"


which output is HELP ME PLEASE, but I can't figure out how this other command can produce the same rot13 transformation:



tr .............A-Z A-ZA-Z <<< "URYC ZR CYRNFR"


So I have two questions:




  1. What's the magic behind the second tr command?

  2. How to make the second command work for both lower and upper case, just like the first command?










share|improve this question









New contributor




Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • I know there's 13 dots. What I wanna know is how it works. There's no explanation about dots in the manual

    – Frederico Oliveira
    2 days ago






  • 4





    you had better hope you don't run into a dot in your input text

    – iruvar
    2 days ago











  • FWIW the shorter form tr [.*13].A-Z A-ZA-Z works just as well as tr .............A-Z A-ZA-Z

    – iruvar
    yesterday


















16















I want to use tr to do some rot13 transformation. I can beautifully understand this command:



tr A-Za-z N-ZA-Mn-za-m <<< "URYC ZR CYRNFR"


which output is HELP ME PLEASE, but I can't figure out how this other command can produce the same rot13 transformation:



tr .............A-Z A-ZA-Z <<< "URYC ZR CYRNFR"


So I have two questions:




  1. What's the magic behind the second tr command?

  2. How to make the second command work for both lower and upper case, just like the first command?










share|improve this question









New contributor




Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • I know there's 13 dots. What I wanna know is how it works. There's no explanation about dots in the manual

    – Frederico Oliveira
    2 days ago






  • 4





    you had better hope you don't run into a dot in your input text

    – iruvar
    2 days ago











  • FWIW the shorter form tr [.*13].A-Z A-ZA-Z works just as well as tr .............A-Z A-ZA-Z

    – iruvar
    yesterday














16












16








16


1






I want to use tr to do some rot13 transformation. I can beautifully understand this command:



tr A-Za-z N-ZA-Mn-za-m <<< "URYC ZR CYRNFR"


which output is HELP ME PLEASE, but I can't figure out how this other command can produce the same rot13 transformation:



tr .............A-Z A-ZA-Z <<< "URYC ZR CYRNFR"


So I have two questions:




  1. What's the magic behind the second tr command?

  2. How to make the second command work for both lower and upper case, just like the first command?










share|improve this question









New contributor




Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I want to use tr to do some rot13 transformation. I can beautifully understand this command:



tr A-Za-z N-ZA-Mn-za-m <<< "URYC ZR CYRNFR"


which output is HELP ME PLEASE, but I can't figure out how this other command can produce the same rot13 transformation:



tr .............A-Z A-ZA-Z <<< "URYC ZR CYRNFR"


So I have two questions:




  1. What's the magic behind the second tr command?

  2. How to make the second command work for both lower and upper case, just like the first command?







tr






share|improve this question









New contributor




Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago









Michael Homer

50.7k8140177




50.7k8140177






New contributor




Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









Frederico OliveiraFrederico Oliveira

1054




1054




New contributor




Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • I know there's 13 dots. What I wanna know is how it works. There's no explanation about dots in the manual

    – Frederico Oliveira
    2 days ago






  • 4





    you had better hope you don't run into a dot in your input text

    – iruvar
    2 days ago











  • FWIW the shorter form tr [.*13].A-Z A-ZA-Z works just as well as tr .............A-Z A-ZA-Z

    – iruvar
    yesterday



















  • I know there's 13 dots. What I wanna know is how it works. There's no explanation about dots in the manual

    – Frederico Oliveira
    2 days ago






  • 4





    you had better hope you don't run into a dot in your input text

    – iruvar
    2 days ago











  • FWIW the shorter form tr [.*13].A-Z A-ZA-Z works just as well as tr .............A-Z A-ZA-Z

    – iruvar
    yesterday

















I know there's 13 dots. What I wanna know is how it works. There's no explanation about dots in the manual

– Frederico Oliveira
2 days ago





I know there's 13 dots. What I wanna know is how it works. There's no explanation about dots in the manual

– Frederico Oliveira
2 days ago




4




4





you had better hope you don't run into a dot in your input text

– iruvar
2 days ago





you had better hope you don't run into a dot in your input text

– iruvar
2 days ago













FWIW the shorter form tr [.*13].A-Z A-ZA-Z works just as well as tr .............A-Z A-ZA-Z

– iruvar
yesterday





FWIW the shorter form tr [.*13].A-Z A-ZA-Z works just as well as tr .............A-Z A-ZA-Z

– iruvar
yesterday










3 Answers
3






active

oldest

votes


















14














It works as follows:



SET1-> .............ABCDEFGHIJKLMNOPQRSTUVWXYZ
SET2-> ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM


So tr will translate SET1 to SET2.



This is equivalent to first one because it is also shifting by 13 units as there 13 dots.



To include the lower case letters, you'll have to arrange them in SET1 with a similar offset, i.e.:



.............ABCDEFGHIJKLMNOPQRSTUVWXYZ..........................abcdefghijklmnopqrstuvwxyz

ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklm


That's 26 dots between Z and a, spanning half the upper-case and half the lower-case alphabet. So the tr command itself will be:



tr .............A-Z..........................a-z A-ZA-Za-za-z





share|improve this answer

































    12














    As @Prvt_Yadv says in their answer, it works because there are 13 dots.



    The sets are



    First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ
    Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


    The dot isn't a special character, so if you have a dot in your input, it will be translated too. In the version of tr that I have, it is the last corresponding character in the second set, in this case an M:



    $ echo URYC ZR CYRNFR. | tr .............A-Z A-ZA-Z
    HELP ME PLEASEM


    (I could imagine that a different version of tr might use the first matching character in set 2, which would give an A.)



    To answer your second question, you need another 13 dots in the first set to "use up" the remaining uppercase letters in set 2:



    First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ.............
    Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


    then you can repeat the pattern:



    First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ..........................abcdefghijklmnopqrstuvwxyz
    Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz


    which gives us:



    tr .............A-Z..........................a-z A-ZA-Za-za-z


    And so:



    $ echo Uryc zr cyrnfr | tr .............A-Z..........................a-z A-ZA-Za-za-z
    Help me please


    Personally, I think the first way of doing it in your question is simpler!



    The first way also doesn't transform any other characters in the input. For example, compare:



    $ echo Uryc zr cyrnfr. | tr .............A-Z..........................a-z A-ZA-Za-za-z  
    Help me pleasem


    with



    $ echo Uryc zr cyrnfr. | tr A-Za-z N-ZA-Mn-za-m
    Help me please.





    share|improve this answer










    New contributor




    user7761803 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.




























      1














      Ok, so thanks to @Prvt_Yadv I was able to understand the dots. Here's the first question answer:




      What's the magic behind the second tr command?




      The 13 dots are simply being mapped to the first 13 letters from the second set. So



      tr .............A-Z A-ZA-Z will produce the following sets:



      SET1 -> .............ABCDEFGHIJKLMNOPQRSTUVXWYZ
      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


      If your input doesn't contain a dot, you can discard the initial sequence, since you won't use those substitution. Then the sets would become:



      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
      SET2 -> NOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


      But since the first set already contains all 26 letters and set2 has repeating trailing letter, those are discarded too, finally becoming



      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
      SET2 -> NOPQRSTUVXWYZABCDEFGHIJKLM


      Which is the rot13 substitution and identical to the first command (except for not dealing with lower cases here). The same logic can be applied for the title of the question:



      tr ...A-Z A-ZA-Z <<< “JVPQBOV” would produce the sets:



      SET1 -> ...ABCDEFGHIJKLMNOPQRSTUVXWYZ
      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


      Discarding the initial sequence and the trailing repeating letters they become:



      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
      SET2 -> DEFGHIJKLMNOPQRSTUVXWYZABC


      Which is the rot3 substitution.



      Now for the second question:




      How to make the second command work for both lower and upper case, just like the first command?




      To make it work you put the desired number of dots at the beginning, matching your rot and 26 dots between to upper sequence and the lower sequence, just like this:



      tr ........A-Z..........................a-z A-ZA-Za-za-z


      This would successfully create an insensitive rot8. To visualize why this works let's see the sets:



      SET1 -> ........ABCDEFGHIJKLMNOPQRSTUVXWYZ..........................abcdefghijklmnopqrstuvxwyz
      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyzabcdefghijklmnopqrstuvxwyz


      Excluding the dots mapping and trailing letters:



      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyz
      SET2 -> IJKLMNOPQRSTUVXWYZABCDEFGHijklmnopqrstuvxwyzabcdefgh


      Now it works for both upper and lower case :)



      Another way to make it works is to use two tr commands as follow:



      tr .............A-Z A-ZA-Z <<< "ABJ V hqrefgnaq" | tr .............a-z a-za-z


      A caveat to using the dots substitution was gave by @iruvar: this command will not work as expected when the input string has dots. This is because the dots are being mapped to other letters and when doing the substitution, tr will change the input dot to the last mapped letter. But you can actually use any other character than dots. So, if using dots in your tr command is a problem, you can use @ instead, for example. This would work just as fine:



      tr @@@@@@@@@@@@@A-Z A-ZA-Z <<< "GUNAX LBH NYY..."





      share|improve this answer










      New contributor




      Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.
















      • 3





        I'm not sure how you concluded that "dots are replaced by a sequence of letters starting from a to the number of dots"; that's not at all the case. There's no magic involved; as Prvt_Yadv explained, there are two sets and tr is mapping from set 1 to set 2, as always, but in this case you've mapped the character . to A, and also B, and also ..., and also M. This doesn't matter since your input doesn't contain a ., but if it did it would turn into an M (tr uses the last output you specify for a given input)

        – Michael Mrozek
        2 days ago











      • Thanks for the clarification. I've updated the answer to fix my mistakes :)

        – Frederico Oliveira
        2 days ago






      • 1





        I admire your (initial) attempts to use science to determine the behaviour of this program, but in future you should come up with as many different hypotheses as possible and design tests to distinguish between all of them before trying to use them. Otherwise you end up getting confused, and adapting your model in a least-changes manner to explain subsequent results until your model's just a mass of special-cases.

        – wizzwizz4
        2 days ago











      • @FredericoOliveira you can accept anyone answer which you found most helpful. Even you can also accept your own answer, if it satisfies you.

        – Prvt_Yadv
        16 hours ago












      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });






      Frederico Oliveira is a new contributor. Be nice, and check out our Code of Conduct.










      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510838%2fwhat-do-the-dots-in-this-tr-command-do-tr-a-z-a-za-z-jvpqbov%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      14














      It works as follows:



      SET1-> .............ABCDEFGHIJKLMNOPQRSTUVWXYZ
      SET2-> ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM


      So tr will translate SET1 to SET2.



      This is equivalent to first one because it is also shifting by 13 units as there 13 dots.



      To include the lower case letters, you'll have to arrange them in SET1 with a similar offset, i.e.:



      .............ABCDEFGHIJKLMNOPQRSTUVWXYZ..........................abcdefghijklmnopqrstuvwxyz

      ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklm


      That's 26 dots between Z and a, spanning half the upper-case and half the lower-case alphabet. So the tr command itself will be:



      tr .............A-Z..........................a-z A-ZA-Za-za-z





      share|improve this answer






























        14














        It works as follows:



        SET1-> .............ABCDEFGHIJKLMNOPQRSTUVWXYZ
        SET2-> ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM


        So tr will translate SET1 to SET2.



        This is equivalent to first one because it is also shifting by 13 units as there 13 dots.



        To include the lower case letters, you'll have to arrange them in SET1 with a similar offset, i.e.:



        .............ABCDEFGHIJKLMNOPQRSTUVWXYZ..........................abcdefghijklmnopqrstuvwxyz

        ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklm


        That's 26 dots between Z and a, spanning half the upper-case and half the lower-case alphabet. So the tr command itself will be:



        tr .............A-Z..........................a-z A-ZA-Za-za-z





        share|improve this answer




























          14












          14








          14







          It works as follows:



          SET1-> .............ABCDEFGHIJKLMNOPQRSTUVWXYZ
          SET2-> ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM


          So tr will translate SET1 to SET2.



          This is equivalent to first one because it is also shifting by 13 units as there 13 dots.



          To include the lower case letters, you'll have to arrange them in SET1 with a similar offset, i.e.:



          .............ABCDEFGHIJKLMNOPQRSTUVWXYZ..........................abcdefghijklmnopqrstuvwxyz

          ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklm


          That's 26 dots between Z and a, spanning half the upper-case and half the lower-case alphabet. So the tr command itself will be:



          tr .............A-Z..........................a-z A-ZA-Za-za-z





          share|improve this answer















          It works as follows:



          SET1-> .............ABCDEFGHIJKLMNOPQRSTUVWXYZ
          SET2-> ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM


          So tr will translate SET1 to SET2.



          This is equivalent to first one because it is also shifting by 13 units as there 13 dots.



          To include the lower case letters, you'll have to arrange them in SET1 with a similar offset, i.e.:



          .............ABCDEFGHIJKLMNOPQRSTUVWXYZ..........................abcdefghijklmnopqrstuvwxyz

          ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklm


          That's 26 dots between Z and a, spanning half the upper-case and half the lower-case alphabet. So the tr command itself will be:



          tr .............A-Z..........................a-z A-ZA-Za-za-z






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 days ago









          ilkkachu

          63.3k10104181




          63.3k10104181










          answered 2 days ago









          Prvt_YadvPrvt_Yadv

          3,22631330




          3,22631330

























              12














              As @Prvt_Yadv says in their answer, it works because there are 13 dots.



              The sets are



              First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ
              Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


              The dot isn't a special character, so if you have a dot in your input, it will be translated too. In the version of tr that I have, it is the last corresponding character in the second set, in this case an M:



              $ echo URYC ZR CYRNFR. | tr .............A-Z A-ZA-Z
              HELP ME PLEASEM


              (I could imagine that a different version of tr might use the first matching character in set 2, which would give an A.)



              To answer your second question, you need another 13 dots in the first set to "use up" the remaining uppercase letters in set 2:



              First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ.............
              Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


              then you can repeat the pattern:



              First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ..........................abcdefghijklmnopqrstuvwxyz
              Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz


              which gives us:



              tr .............A-Z..........................a-z A-ZA-Za-za-z


              And so:



              $ echo Uryc zr cyrnfr | tr .............A-Z..........................a-z A-ZA-Za-za-z
              Help me please


              Personally, I think the first way of doing it in your question is simpler!



              The first way also doesn't transform any other characters in the input. For example, compare:



              $ echo Uryc zr cyrnfr. | tr .............A-Z..........................a-z A-ZA-Za-za-z  
              Help me pleasem


              with



              $ echo Uryc zr cyrnfr. | tr A-Za-z N-ZA-Mn-za-m
              Help me please.





              share|improve this answer










              New contributor




              user7761803 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

























                12














                As @Prvt_Yadv says in their answer, it works because there are 13 dots.



                The sets are



                First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ
                Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


                The dot isn't a special character, so if you have a dot in your input, it will be translated too. In the version of tr that I have, it is the last corresponding character in the second set, in this case an M:



                $ echo URYC ZR CYRNFR. | tr .............A-Z A-ZA-Z
                HELP ME PLEASEM


                (I could imagine that a different version of tr might use the first matching character in set 2, which would give an A.)



                To answer your second question, you need another 13 dots in the first set to "use up" the remaining uppercase letters in set 2:



                First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ.............
                Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


                then you can repeat the pattern:



                First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ..........................abcdefghijklmnopqrstuvwxyz
                Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz


                which gives us:



                tr .............A-Z..........................a-z A-ZA-Za-za-z


                And so:



                $ echo Uryc zr cyrnfr | tr .............A-Z..........................a-z A-ZA-Za-za-z
                Help me please


                Personally, I think the first way of doing it in your question is simpler!



                The first way also doesn't transform any other characters in the input. For example, compare:



                $ echo Uryc zr cyrnfr. | tr .............A-Z..........................a-z A-ZA-Za-za-z  
                Help me pleasem


                with



                $ echo Uryc zr cyrnfr. | tr A-Za-z N-ZA-Mn-za-m
                Help me please.





                share|improve this answer










                New contributor




                user7761803 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.























                  12












                  12








                  12







                  As @Prvt_Yadv says in their answer, it works because there are 13 dots.



                  The sets are



                  First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ
                  Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


                  The dot isn't a special character, so if you have a dot in your input, it will be translated too. In the version of tr that I have, it is the last corresponding character in the second set, in this case an M:



                  $ echo URYC ZR CYRNFR. | tr .............A-Z A-ZA-Z
                  HELP ME PLEASEM


                  (I could imagine that a different version of tr might use the first matching character in set 2, which would give an A.)



                  To answer your second question, you need another 13 dots in the first set to "use up" the remaining uppercase letters in set 2:



                  First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ.............
                  Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


                  then you can repeat the pattern:



                  First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ..........................abcdefghijklmnopqrstuvwxyz
                  Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz


                  which gives us:



                  tr .............A-Z..........................a-z A-ZA-Za-za-z


                  And so:



                  $ echo Uryc zr cyrnfr | tr .............A-Z..........................a-z A-ZA-Za-za-z
                  Help me please


                  Personally, I think the first way of doing it in your question is simpler!



                  The first way also doesn't transform any other characters in the input. For example, compare:



                  $ echo Uryc zr cyrnfr. | tr .............A-Z..........................a-z A-ZA-Za-za-z  
                  Help me pleasem


                  with



                  $ echo Uryc zr cyrnfr. | tr A-Za-z N-ZA-Mn-za-m
                  Help me please.





                  share|improve this answer










                  New contributor




                  user7761803 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  As @Prvt_Yadv says in their answer, it works because there are 13 dots.



                  The sets are



                  First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ
                  Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


                  The dot isn't a special character, so if you have a dot in your input, it will be translated too. In the version of tr that I have, it is the last corresponding character in the second set, in this case an M:



                  $ echo URYC ZR CYRNFR. | tr .............A-Z A-ZA-Z
                  HELP ME PLEASEM


                  (I could imagine that a different version of tr might use the first matching character in set 2, which would give an A.)



                  To answer your second question, you need another 13 dots in the first set to "use up" the remaining uppercase letters in set 2:



                  First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ.............
                  Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ


                  then you can repeat the pattern:



                  First set:  .............ABCDEFGHIJKLMNOPQRSTUVWXYZ..........................abcdefghijklmnopqrstuvwxyz
                  Second set: ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz


                  which gives us:



                  tr .............A-Z..........................a-z A-ZA-Za-za-z


                  And so:



                  $ echo Uryc zr cyrnfr | tr .............A-Z..........................a-z A-ZA-Za-za-z
                  Help me please


                  Personally, I think the first way of doing it in your question is simpler!



                  The first way also doesn't transform any other characters in the input. For example, compare:



                  $ echo Uryc zr cyrnfr. | tr .............A-Z..........................a-z A-ZA-Za-za-z  
                  Help me pleasem


                  with



                  $ echo Uryc zr cyrnfr. | tr A-Za-z N-ZA-Mn-za-m
                  Help me please.






                  share|improve this answer










                  New contributor




                  user7761803 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer








                  edited 2 days ago





















                  New contributor




                  user7761803 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 2 days ago









                  user7761803user7761803

                  1213




                  1213




                  New contributor




                  user7761803 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  user7761803 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  user7761803 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.























                      1














                      Ok, so thanks to @Prvt_Yadv I was able to understand the dots. Here's the first question answer:




                      What's the magic behind the second tr command?




                      The 13 dots are simply being mapped to the first 13 letters from the second set. So



                      tr .............A-Z A-ZA-Z will produce the following sets:



                      SET1 -> .............ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      If your input doesn't contain a dot, you can discard the initial sequence, since you won't use those substitution. Then the sets would become:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> NOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      But since the first set already contains all 26 letters and set2 has repeating trailing letter, those are discarded too, finally becoming



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> NOPQRSTUVXWYZABCDEFGHIJKLM


                      Which is the rot13 substitution and identical to the first command (except for not dealing with lower cases here). The same logic can be applied for the title of the question:



                      tr ...A-Z A-ZA-Z <<< “JVPQBOV” would produce the sets:



                      SET1 -> ...ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      Discarding the initial sequence and the trailing repeating letters they become:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> DEFGHIJKLMNOPQRSTUVXWYZABC


                      Which is the rot3 substitution.



                      Now for the second question:




                      How to make the second command work for both lower and upper case, just like the first command?




                      To make it work you put the desired number of dots at the beginning, matching your rot and 26 dots between to upper sequence and the lower sequence, just like this:



                      tr ........A-Z..........................a-z A-ZA-Za-za-z


                      This would successfully create an insensitive rot8. To visualize why this works let's see the sets:



                      SET1 -> ........ABCDEFGHIJKLMNOPQRSTUVXWYZ..........................abcdefghijklmnopqrstuvxwyz
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyzabcdefghijklmnopqrstuvxwyz


                      Excluding the dots mapping and trailing letters:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyz
                      SET2 -> IJKLMNOPQRSTUVXWYZABCDEFGHijklmnopqrstuvxwyzabcdefgh


                      Now it works for both upper and lower case :)



                      Another way to make it works is to use two tr commands as follow:



                      tr .............A-Z A-ZA-Z <<< "ABJ V hqrefgnaq" | tr .............a-z a-za-z


                      A caveat to using the dots substitution was gave by @iruvar: this command will not work as expected when the input string has dots. This is because the dots are being mapped to other letters and when doing the substitution, tr will change the input dot to the last mapped letter. But you can actually use any other character than dots. So, if using dots in your tr command is a problem, you can use @ instead, for example. This would work just as fine:



                      tr @@@@@@@@@@@@@A-Z A-ZA-Z <<< "GUNAX LBH NYY..."





                      share|improve this answer










                      New contributor




                      Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.
















                      • 3





                        I'm not sure how you concluded that "dots are replaced by a sequence of letters starting from a to the number of dots"; that's not at all the case. There's no magic involved; as Prvt_Yadv explained, there are two sets and tr is mapping from set 1 to set 2, as always, but in this case you've mapped the character . to A, and also B, and also ..., and also M. This doesn't matter since your input doesn't contain a ., but if it did it would turn into an M (tr uses the last output you specify for a given input)

                        – Michael Mrozek
                        2 days ago











                      • Thanks for the clarification. I've updated the answer to fix my mistakes :)

                        – Frederico Oliveira
                        2 days ago






                      • 1





                        I admire your (initial) attempts to use science to determine the behaviour of this program, but in future you should come up with as many different hypotheses as possible and design tests to distinguish between all of them before trying to use them. Otherwise you end up getting confused, and adapting your model in a least-changes manner to explain subsequent results until your model's just a mass of special-cases.

                        – wizzwizz4
                        2 days ago











                      • @FredericoOliveira you can accept anyone answer which you found most helpful. Even you can also accept your own answer, if it satisfies you.

                        – Prvt_Yadv
                        16 hours ago
















                      1














                      Ok, so thanks to @Prvt_Yadv I was able to understand the dots. Here's the first question answer:




                      What's the magic behind the second tr command?




                      The 13 dots are simply being mapped to the first 13 letters from the second set. So



                      tr .............A-Z A-ZA-Z will produce the following sets:



                      SET1 -> .............ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      If your input doesn't contain a dot, you can discard the initial sequence, since you won't use those substitution. Then the sets would become:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> NOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      But since the first set already contains all 26 letters and set2 has repeating trailing letter, those are discarded too, finally becoming



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> NOPQRSTUVXWYZABCDEFGHIJKLM


                      Which is the rot13 substitution and identical to the first command (except for not dealing with lower cases here). The same logic can be applied for the title of the question:



                      tr ...A-Z A-ZA-Z <<< “JVPQBOV” would produce the sets:



                      SET1 -> ...ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      Discarding the initial sequence and the trailing repeating letters they become:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> DEFGHIJKLMNOPQRSTUVXWYZABC


                      Which is the rot3 substitution.



                      Now for the second question:




                      How to make the second command work for both lower and upper case, just like the first command?




                      To make it work you put the desired number of dots at the beginning, matching your rot and 26 dots between to upper sequence and the lower sequence, just like this:



                      tr ........A-Z..........................a-z A-ZA-Za-za-z


                      This would successfully create an insensitive rot8. To visualize why this works let's see the sets:



                      SET1 -> ........ABCDEFGHIJKLMNOPQRSTUVXWYZ..........................abcdefghijklmnopqrstuvxwyz
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyzabcdefghijklmnopqrstuvxwyz


                      Excluding the dots mapping and trailing letters:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyz
                      SET2 -> IJKLMNOPQRSTUVXWYZABCDEFGHijklmnopqrstuvxwyzabcdefgh


                      Now it works for both upper and lower case :)



                      Another way to make it works is to use two tr commands as follow:



                      tr .............A-Z A-ZA-Z <<< "ABJ V hqrefgnaq" | tr .............a-z a-za-z


                      A caveat to using the dots substitution was gave by @iruvar: this command will not work as expected when the input string has dots. This is because the dots are being mapped to other letters and when doing the substitution, tr will change the input dot to the last mapped letter. But you can actually use any other character than dots. So, if using dots in your tr command is a problem, you can use @ instead, for example. This would work just as fine:



                      tr @@@@@@@@@@@@@A-Z A-ZA-Z <<< "GUNAX LBH NYY..."





                      share|improve this answer










                      New contributor




                      Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.
















                      • 3





                        I'm not sure how you concluded that "dots are replaced by a sequence of letters starting from a to the number of dots"; that's not at all the case. There's no magic involved; as Prvt_Yadv explained, there are two sets and tr is mapping from set 1 to set 2, as always, but in this case you've mapped the character . to A, and also B, and also ..., and also M. This doesn't matter since your input doesn't contain a ., but if it did it would turn into an M (tr uses the last output you specify for a given input)

                        – Michael Mrozek
                        2 days ago











                      • Thanks for the clarification. I've updated the answer to fix my mistakes :)

                        – Frederico Oliveira
                        2 days ago






                      • 1





                        I admire your (initial) attempts to use science to determine the behaviour of this program, but in future you should come up with as many different hypotheses as possible and design tests to distinguish between all of them before trying to use them. Otherwise you end up getting confused, and adapting your model in a least-changes manner to explain subsequent results until your model's just a mass of special-cases.

                        – wizzwizz4
                        2 days ago











                      • @FredericoOliveira you can accept anyone answer which you found most helpful. Even you can also accept your own answer, if it satisfies you.

                        – Prvt_Yadv
                        16 hours ago














                      1












                      1








                      1







                      Ok, so thanks to @Prvt_Yadv I was able to understand the dots. Here's the first question answer:




                      What's the magic behind the second tr command?




                      The 13 dots are simply being mapped to the first 13 letters from the second set. So



                      tr .............A-Z A-ZA-Z will produce the following sets:



                      SET1 -> .............ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      If your input doesn't contain a dot, you can discard the initial sequence, since you won't use those substitution. Then the sets would become:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> NOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      But since the first set already contains all 26 letters and set2 has repeating trailing letter, those are discarded too, finally becoming



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> NOPQRSTUVXWYZABCDEFGHIJKLM


                      Which is the rot13 substitution and identical to the first command (except for not dealing with lower cases here). The same logic can be applied for the title of the question:



                      tr ...A-Z A-ZA-Z <<< “JVPQBOV” would produce the sets:



                      SET1 -> ...ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      Discarding the initial sequence and the trailing repeating letters they become:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> DEFGHIJKLMNOPQRSTUVXWYZABC


                      Which is the rot3 substitution.



                      Now for the second question:




                      How to make the second command work for both lower and upper case, just like the first command?




                      To make it work you put the desired number of dots at the beginning, matching your rot and 26 dots between to upper sequence and the lower sequence, just like this:



                      tr ........A-Z..........................a-z A-ZA-Za-za-z


                      This would successfully create an insensitive rot8. To visualize why this works let's see the sets:



                      SET1 -> ........ABCDEFGHIJKLMNOPQRSTUVXWYZ..........................abcdefghijklmnopqrstuvxwyz
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyzabcdefghijklmnopqrstuvxwyz


                      Excluding the dots mapping and trailing letters:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyz
                      SET2 -> IJKLMNOPQRSTUVXWYZABCDEFGHijklmnopqrstuvxwyzabcdefgh


                      Now it works for both upper and lower case :)



                      Another way to make it works is to use two tr commands as follow:



                      tr .............A-Z A-ZA-Z <<< "ABJ V hqrefgnaq" | tr .............a-z a-za-z


                      A caveat to using the dots substitution was gave by @iruvar: this command will not work as expected when the input string has dots. This is because the dots are being mapped to other letters and when doing the substitution, tr will change the input dot to the last mapped letter. But you can actually use any other character than dots. So, if using dots in your tr command is a problem, you can use @ instead, for example. This would work just as fine:



                      tr @@@@@@@@@@@@@A-Z A-ZA-Z <<< "GUNAX LBH NYY..."





                      share|improve this answer










                      New contributor




                      Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.










                      Ok, so thanks to @Prvt_Yadv I was able to understand the dots. Here's the first question answer:




                      What's the magic behind the second tr command?




                      The 13 dots are simply being mapped to the first 13 letters from the second set. So



                      tr .............A-Z A-ZA-Z will produce the following sets:



                      SET1 -> .............ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      If your input doesn't contain a dot, you can discard the initial sequence, since you won't use those substitution. Then the sets would become:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> NOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      But since the first set already contains all 26 letters and set2 has repeating trailing letter, those are discarded too, finally becoming



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> NOPQRSTUVXWYZABCDEFGHIJKLM


                      Which is the rot13 substitution and identical to the first command (except for not dealing with lower cases here). The same logic can be applied for the title of the question:



                      tr ...A-Z A-ZA-Z <<< “JVPQBOV” would produce the sets:



                      SET1 -> ...ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZ


                      Discarding the initial sequence and the trailing repeating letters they become:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZ
                      SET2 -> DEFGHIJKLMNOPQRSTUVXWYZABC


                      Which is the rot3 substitution.



                      Now for the second question:




                      How to make the second command work for both lower and upper case, just like the first command?




                      To make it work you put the desired number of dots at the beginning, matching your rot and 26 dots between to upper sequence and the lower sequence, just like this:



                      tr ........A-Z..........................a-z A-ZA-Za-za-z


                      This would successfully create an insensitive rot8. To visualize why this works let's see the sets:



                      SET1 -> ........ABCDEFGHIJKLMNOPQRSTUVXWYZ..........................abcdefghijklmnopqrstuvxwyz
                      SET2 -> ABCDEFGHIJKLMNOPQRSTUVXWYZABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyzabcdefghijklmnopqrstuvxwyz


                      Excluding the dots mapping and trailing letters:



                      SET1 -> ABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyz
                      SET2 -> IJKLMNOPQRSTUVXWYZABCDEFGHijklmnopqrstuvxwyzabcdefgh


                      Now it works for both upper and lower case :)



                      Another way to make it works is to use two tr commands as follow:



                      tr .............A-Z A-ZA-Z <<< "ABJ V hqrefgnaq" | tr .............a-z a-za-z


                      A caveat to using the dots substitution was gave by @iruvar: this command will not work as expected when the input string has dots. This is because the dots are being mapped to other letters and when doing the substitution, tr will change the input dot to the last mapped letter. But you can actually use any other character than dots. So, if using dots in your tr command is a problem, you can use @ instead, for example. This would work just as fine:



                      tr @@@@@@@@@@@@@A-Z A-ZA-Z <<< "GUNAX LBH NYY..."






                      share|improve this answer










                      New contributor




                      Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.









                      share|improve this answer



                      share|improve this answer








                      edited 2 days ago





















                      New contributor




                      Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.









                      answered 2 days ago









                      Frederico OliveiraFrederico Oliveira

                      1054




                      1054




                      New contributor




                      Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.





                      New contributor





                      Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.






                      Frederico Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.








                      • 3





                        I'm not sure how you concluded that "dots are replaced by a sequence of letters starting from a to the number of dots"; that's not at all the case. There's no magic involved; as Prvt_Yadv explained, there are two sets and tr is mapping from set 1 to set 2, as always, but in this case you've mapped the character . to A, and also B, and also ..., and also M. This doesn't matter since your input doesn't contain a ., but if it did it would turn into an M (tr uses the last output you specify for a given input)

                        – Michael Mrozek
                        2 days ago











                      • Thanks for the clarification. I've updated the answer to fix my mistakes :)

                        – Frederico Oliveira
                        2 days ago






                      • 1





                        I admire your (initial) attempts to use science to determine the behaviour of this program, but in future you should come up with as many different hypotheses as possible and design tests to distinguish between all of them before trying to use them. Otherwise you end up getting confused, and adapting your model in a least-changes manner to explain subsequent results until your model's just a mass of special-cases.

                        – wizzwizz4
                        2 days ago











                      • @FredericoOliveira you can accept anyone answer which you found most helpful. Even you can also accept your own answer, if it satisfies you.

                        – Prvt_Yadv
                        16 hours ago














                      • 3





                        I'm not sure how you concluded that "dots are replaced by a sequence of letters starting from a to the number of dots"; that's not at all the case. There's no magic involved; as Prvt_Yadv explained, there are two sets and tr is mapping from set 1 to set 2, as always, but in this case you've mapped the character . to A, and also B, and also ..., and also M. This doesn't matter since your input doesn't contain a ., but if it did it would turn into an M (tr uses the last output you specify for a given input)

                        – Michael Mrozek
                        2 days ago











                      • Thanks for the clarification. I've updated the answer to fix my mistakes :)

                        – Frederico Oliveira
                        2 days ago






                      • 1





                        I admire your (initial) attempts to use science to determine the behaviour of this program, but in future you should come up with as many different hypotheses as possible and design tests to distinguish between all of them before trying to use them. Otherwise you end up getting confused, and adapting your model in a least-changes manner to explain subsequent results until your model's just a mass of special-cases.

                        – wizzwizz4
                        2 days ago











                      • @FredericoOliveira you can accept anyone answer which you found most helpful. Even you can also accept your own answer, if it satisfies you.

                        – Prvt_Yadv
                        16 hours ago








                      3




                      3





                      I'm not sure how you concluded that "dots are replaced by a sequence of letters starting from a to the number of dots"; that's not at all the case. There's no magic involved; as Prvt_Yadv explained, there are two sets and tr is mapping from set 1 to set 2, as always, but in this case you've mapped the character . to A, and also B, and also ..., and also M. This doesn't matter since your input doesn't contain a ., but if it did it would turn into an M (tr uses the last output you specify for a given input)

                      – Michael Mrozek
                      2 days ago





                      I'm not sure how you concluded that "dots are replaced by a sequence of letters starting from a to the number of dots"; that's not at all the case. There's no magic involved; as Prvt_Yadv explained, there are two sets and tr is mapping from set 1 to set 2, as always, but in this case you've mapped the character . to A, and also B, and also ..., and also M. This doesn't matter since your input doesn't contain a ., but if it did it would turn into an M (tr uses the last output you specify for a given input)

                      – Michael Mrozek
                      2 days ago













                      Thanks for the clarification. I've updated the answer to fix my mistakes :)

                      – Frederico Oliveira
                      2 days ago





                      Thanks for the clarification. I've updated the answer to fix my mistakes :)

                      – Frederico Oliveira
                      2 days ago




                      1




                      1





                      I admire your (initial) attempts to use science to determine the behaviour of this program, but in future you should come up with as many different hypotheses as possible and design tests to distinguish between all of them before trying to use them. Otherwise you end up getting confused, and adapting your model in a least-changes manner to explain subsequent results until your model's just a mass of special-cases.

                      – wizzwizz4
                      2 days ago





                      I admire your (initial) attempts to use science to determine the behaviour of this program, but in future you should come up with as many different hypotheses as possible and design tests to distinguish between all of them before trying to use them. Otherwise you end up getting confused, and adapting your model in a least-changes manner to explain subsequent results until your model's just a mass of special-cases.

                      – wizzwizz4
                      2 days ago













                      @FredericoOliveira you can accept anyone answer which you found most helpful. Even you can also accept your own answer, if it satisfies you.

                      – Prvt_Yadv
                      16 hours ago





                      @FredericoOliveira you can accept anyone answer which you found most helpful. Even you can also accept your own answer, if it satisfies you.

                      – Prvt_Yadv
                      16 hours ago










                      Frederico Oliveira is a new contributor. Be nice, and check out our Code of Conduct.










                      draft saved

                      draft discarded


















                      Frederico Oliveira is a new contributor. Be nice, and check out our Code of Conduct.













                      Frederico Oliveira is a new contributor. Be nice, and check out our Code of Conduct.












                      Frederico Oliveira is a new contributor. Be nice, and check out our Code of Conduct.
















                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510838%2fwhat-do-the-dots-in-this-tr-command-do-tr-a-z-a-za-z-jvpqbov%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Webac Holding Inhaltsverzeichnis Geschichte | Organisationsstruktur | Tochterfirmen |...

                      What's the meaning of a knight fighting a snail in medieval book illustrations?What is the meaning of a glove...

                      Salamanca Inhaltsverzeichnis Lage und Klima | Bevölkerungsentwicklung | Geschichte | Kultur und...