how to get a whitespace - whitespace recursively after all my track numbers in my music folder with the...





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







0















How can I get a white-space dash white-space recursively after all my track numbers in my music folder with the command line?










share|improve this question





























    0















    How can I get a white-space dash white-space recursively after all my track numbers in my music folder with the command line?










    share|improve this question

























      0












      0








      0








      How can I get a white-space dash white-space recursively after all my track numbers in my music folder with the command line?










      share|improve this question














      How can I get a white-space dash white-space recursively after all my track numbers in my music folder with the command line?







      command-line






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 21 at 7:43









      user179732user179732

      315




      315






















          2 Answers
          2






          active

          oldest

          votes


















          1














          You should also indicate how your file names currently appear. If, for example, a folder containing a list of files looks like this:



          $ ls -1v
          1Music.mp3
          2Music.mp3
          3Music.mp3
          4Music.mp3
          5Music.mp3
          6Music.mp3
          7Music.mp3
          8Music.mp3
          9Music.mp3
          10Music.mp3


          We can use:



          rename "s/(^[0-9]+)/$1 - /" *.mp3


          To get:



          '1 - Music.mp3'
          '2 - Music.mp3'
          '3 - Music.mp3'
          '4 - Music.mp3'
          '5 - Music.mp3'
          '6 - Music.mp3'
          '7 - Music.mp3'
          '8 - Music.mp3'
          '9 - Music.mp3'
          '10 - Music.mp3'


          To be on the safe side, use the -n option to test your command first:



          rename -n "s/(^[0-9]+)/$1 - /" *.mp3


          This command will show how the files will be renamed, without actually renaming them.






          share|improve this answer


























          • Can someone break the expression find . -regex '.*.s.*' down for me so I can understand what the various characters mean to make adjustments?I would like to use rename to get from 01. Nobody's Diary.mp3 to 01 - Nobody's Diary.mp3 ?

            – user179732
            Feb 21 at 10:50













          • @user179732 please edit that information into your question

            – steeldriver
            Feb 21 at 13:26













          • How can I get rid of the . when I use "rename -n "s/(^[0-9]+)/$1 - /" *.mp3" to get from "rename(11. Lie About Us.mp3, 11 - . Lie About Us.mp3)"

            – user179732
            Feb 22 at 16:33



















          0














          You can search for such a filename pattern using a regular expression.



          find . -regex '.*s-s.*'



          • Use the find command which searches recursively by default. The . as the first argument represents the path to search in, you can replace it with any arbitrary path if you don’t want to search in the current working directory.

          • Whitespace is represented by s in regular expressions.

          • I’ll assume you mean hyphen (which can be found on the keyboard) by the term dash. However, the hyphen has special meaning in regular expressions and must be escaped using -. If you want to include other dash types, you should cover them using a character set in your regex, e.g. [-–—].

          • Starting and ending the regex with .* allows any characters (including none) before and after the pattern we focus on.






          share|improve this answer


























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1120039%2fhow-to-get-a-whitespace-whitespace-recursively-after-all-my-track-numbers-in-m%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You should also indicate how your file names currently appear. If, for example, a folder containing a list of files looks like this:



            $ ls -1v
            1Music.mp3
            2Music.mp3
            3Music.mp3
            4Music.mp3
            5Music.mp3
            6Music.mp3
            7Music.mp3
            8Music.mp3
            9Music.mp3
            10Music.mp3


            We can use:



            rename "s/(^[0-9]+)/$1 - /" *.mp3


            To get:



            '1 - Music.mp3'
            '2 - Music.mp3'
            '3 - Music.mp3'
            '4 - Music.mp3'
            '5 - Music.mp3'
            '6 - Music.mp3'
            '7 - Music.mp3'
            '8 - Music.mp3'
            '9 - Music.mp3'
            '10 - Music.mp3'


            To be on the safe side, use the -n option to test your command first:



            rename -n "s/(^[0-9]+)/$1 - /" *.mp3


            This command will show how the files will be renamed, without actually renaming them.






            share|improve this answer


























            • Can someone break the expression find . -regex '.*.s.*' down for me so I can understand what the various characters mean to make adjustments?I would like to use rename to get from 01. Nobody's Diary.mp3 to 01 - Nobody's Diary.mp3 ?

              – user179732
              Feb 21 at 10:50













            • @user179732 please edit that information into your question

              – steeldriver
              Feb 21 at 13:26













            • How can I get rid of the . when I use "rename -n "s/(^[0-9]+)/$1 - /" *.mp3" to get from "rename(11. Lie About Us.mp3, 11 - . Lie About Us.mp3)"

              – user179732
              Feb 22 at 16:33
















            1














            You should also indicate how your file names currently appear. If, for example, a folder containing a list of files looks like this:



            $ ls -1v
            1Music.mp3
            2Music.mp3
            3Music.mp3
            4Music.mp3
            5Music.mp3
            6Music.mp3
            7Music.mp3
            8Music.mp3
            9Music.mp3
            10Music.mp3


            We can use:



            rename "s/(^[0-9]+)/$1 - /" *.mp3


            To get:



            '1 - Music.mp3'
            '2 - Music.mp3'
            '3 - Music.mp3'
            '4 - Music.mp3'
            '5 - Music.mp3'
            '6 - Music.mp3'
            '7 - Music.mp3'
            '8 - Music.mp3'
            '9 - Music.mp3'
            '10 - Music.mp3'


            To be on the safe side, use the -n option to test your command first:



            rename -n "s/(^[0-9]+)/$1 - /" *.mp3


            This command will show how the files will be renamed, without actually renaming them.






            share|improve this answer


























            • Can someone break the expression find . -regex '.*.s.*' down for me so I can understand what the various characters mean to make adjustments?I would like to use rename to get from 01. Nobody's Diary.mp3 to 01 - Nobody's Diary.mp3 ?

              – user179732
              Feb 21 at 10:50













            • @user179732 please edit that information into your question

              – steeldriver
              Feb 21 at 13:26













            • How can I get rid of the . when I use "rename -n "s/(^[0-9]+)/$1 - /" *.mp3" to get from "rename(11. Lie About Us.mp3, 11 - . Lie About Us.mp3)"

              – user179732
              Feb 22 at 16:33














            1












            1








            1







            You should also indicate how your file names currently appear. If, for example, a folder containing a list of files looks like this:



            $ ls -1v
            1Music.mp3
            2Music.mp3
            3Music.mp3
            4Music.mp3
            5Music.mp3
            6Music.mp3
            7Music.mp3
            8Music.mp3
            9Music.mp3
            10Music.mp3


            We can use:



            rename "s/(^[0-9]+)/$1 - /" *.mp3


            To get:



            '1 - Music.mp3'
            '2 - Music.mp3'
            '3 - Music.mp3'
            '4 - Music.mp3'
            '5 - Music.mp3'
            '6 - Music.mp3'
            '7 - Music.mp3'
            '8 - Music.mp3'
            '9 - Music.mp3'
            '10 - Music.mp3'


            To be on the safe side, use the -n option to test your command first:



            rename -n "s/(^[0-9]+)/$1 - /" *.mp3


            This command will show how the files will be renamed, without actually renaming them.






            share|improve this answer















            You should also indicate how your file names currently appear. If, for example, a folder containing a list of files looks like this:



            $ ls -1v
            1Music.mp3
            2Music.mp3
            3Music.mp3
            4Music.mp3
            5Music.mp3
            6Music.mp3
            7Music.mp3
            8Music.mp3
            9Music.mp3
            10Music.mp3


            We can use:



            rename "s/(^[0-9]+)/$1 - /" *.mp3


            To get:



            '1 - Music.mp3'
            '2 - Music.mp3'
            '3 - Music.mp3'
            '4 - Music.mp3'
            '5 - Music.mp3'
            '6 - Music.mp3'
            '7 - Music.mp3'
            '8 - Music.mp3'
            '9 - Music.mp3'
            '10 - Music.mp3'


            To be on the safe side, use the -n option to test your command first:



            rename -n "s/(^[0-9]+)/$1 - /" *.mp3


            This command will show how the files will be renamed, without actually renaming them.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Feb 21 at 9:11









            vanadium

            7,91811533




            7,91811533










            answered Feb 21 at 7:55









            RavexinaRavexina

            33.6k1490118




            33.6k1490118













            • Can someone break the expression find . -regex '.*.s.*' down for me so I can understand what the various characters mean to make adjustments?I would like to use rename to get from 01. Nobody's Diary.mp3 to 01 - Nobody's Diary.mp3 ?

              – user179732
              Feb 21 at 10:50













            • @user179732 please edit that information into your question

              – steeldriver
              Feb 21 at 13:26













            • How can I get rid of the . when I use "rename -n "s/(^[0-9]+)/$1 - /" *.mp3" to get from "rename(11. Lie About Us.mp3, 11 - . Lie About Us.mp3)"

              – user179732
              Feb 22 at 16:33



















            • Can someone break the expression find . -regex '.*.s.*' down for me so I can understand what the various characters mean to make adjustments?I would like to use rename to get from 01. Nobody's Diary.mp3 to 01 - Nobody's Diary.mp3 ?

              – user179732
              Feb 21 at 10:50













            • @user179732 please edit that information into your question

              – steeldriver
              Feb 21 at 13:26













            • How can I get rid of the . when I use "rename -n "s/(^[0-9]+)/$1 - /" *.mp3" to get from "rename(11. Lie About Us.mp3, 11 - . Lie About Us.mp3)"

              – user179732
              Feb 22 at 16:33

















            Can someone break the expression find . -regex '.*.s.*' down for me so I can understand what the various characters mean to make adjustments?I would like to use rename to get from 01. Nobody's Diary.mp3 to 01 - Nobody's Diary.mp3 ?

            – user179732
            Feb 21 at 10:50







            Can someone break the expression find . -regex '.*.s.*' down for me so I can understand what the various characters mean to make adjustments?I would like to use rename to get from 01. Nobody's Diary.mp3 to 01 - Nobody's Diary.mp3 ?

            – user179732
            Feb 21 at 10:50















            @user179732 please edit that information into your question

            – steeldriver
            Feb 21 at 13:26







            @user179732 please edit that information into your question

            – steeldriver
            Feb 21 at 13:26















            How can I get rid of the . when I use "rename -n "s/(^[0-9]+)/$1 - /" *.mp3" to get from "rename(11. Lie About Us.mp3, 11 - . Lie About Us.mp3)"

            – user179732
            Feb 22 at 16:33





            How can I get rid of the . when I use "rename -n "s/(^[0-9]+)/$1 - /" *.mp3" to get from "rename(11. Lie About Us.mp3, 11 - . Lie About Us.mp3)"

            – user179732
            Feb 22 at 16:33













            0














            You can search for such a filename pattern using a regular expression.



            find . -regex '.*s-s.*'



            • Use the find command which searches recursively by default. The . as the first argument represents the path to search in, you can replace it with any arbitrary path if you don’t want to search in the current working directory.

            • Whitespace is represented by s in regular expressions.

            • I’ll assume you mean hyphen (which can be found on the keyboard) by the term dash. However, the hyphen has special meaning in regular expressions and must be escaped using -. If you want to include other dash types, you should cover them using a character set in your regex, e.g. [-–—].

            • Starting and ending the regex with .* allows any characters (including none) before and after the pattern we focus on.






            share|improve this answer






























              0














              You can search for such a filename pattern using a regular expression.



              find . -regex '.*s-s.*'



              • Use the find command which searches recursively by default. The . as the first argument represents the path to search in, you can replace it with any arbitrary path if you don’t want to search in the current working directory.

              • Whitespace is represented by s in regular expressions.

              • I’ll assume you mean hyphen (which can be found on the keyboard) by the term dash. However, the hyphen has special meaning in regular expressions and must be escaped using -. If you want to include other dash types, you should cover them using a character set in your regex, e.g. [-–—].

              • Starting and ending the regex with .* allows any characters (including none) before and after the pattern we focus on.






              share|improve this answer




























                0












                0








                0







                You can search for such a filename pattern using a regular expression.



                find . -regex '.*s-s.*'



                • Use the find command which searches recursively by default. The . as the first argument represents the path to search in, you can replace it with any arbitrary path if you don’t want to search in the current working directory.

                • Whitespace is represented by s in regular expressions.

                • I’ll assume you mean hyphen (which can be found on the keyboard) by the term dash. However, the hyphen has special meaning in regular expressions and must be escaped using -. If you want to include other dash types, you should cover them using a character set in your regex, e.g. [-–—].

                • Starting and ending the regex with .* allows any characters (including none) before and after the pattern we focus on.






                share|improve this answer















                You can search for such a filename pattern using a regular expression.



                find . -regex '.*s-s.*'



                • Use the find command which searches recursively by default. The . as the first argument represents the path to search in, you can replace it with any arbitrary path if you don’t want to search in the current working directory.

                • Whitespace is represented by s in regular expressions.

                • I’ll assume you mean hyphen (which can be found on the keyboard) by the term dash. However, the hyphen has special meaning in regular expressions and must be escaped using -. If you want to include other dash types, you should cover them using a character set in your regex, e.g. [-–—].

                • Starting and ending the regex with .* allows any characters (including none) before and after the pattern we focus on.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Feb 21 at 9:25

























                answered Feb 21 at 9:20









                MelebiusMelebius

                5,11852041




                5,11852041






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • 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%2faskubuntu.com%2fquestions%2f1120039%2fhow-to-get-a-whitespace-whitespace-recursively-after-all-my-track-numbers-in-m%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

                    How to change which sound is reproduced for terminal bell?

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents