Can the output of find with the -printf flag be colorized?Exclude symbolic links to other filesystems with...

Would Buddhists help non-Buddhists continuing their attachments?

Did this character show any indication of wanting to rule before S8E6?

Co-author wants to put their current funding source in the acknowledgements section because they edited the paper

Expected maximum number of unpaired socks

Sorting with IComparable design

Heat lost in ideal capacitor charging

How did NASA Langley end up with the first 737?

What did the 'turbo' button actually do?

Is "vegetable base" a common term in English?

Can a UK national work as a paid shop assistant in the USA?

...And they were stumped for a long time

How was Daenerys able to legitimise Gendry?

What is the recommended procedure to land a taildragger in a crosswind?

What were the Ethiopians doing in Xerxes' army?

Security vulnerabilities of POST over SSL

One word for 'the thing that attracts me'?

Why do Russians almost not use verbs of possession akin to "have"?

Does French have the English "short i" vowel?

How to let other coworkers know that I don't share my coworker's political views?

Freedom of Speech and Assembly in China

What could a self-sustaining lunar colony slowly lose that would ultimately prove fatal?

Which European Languages are not Indo-European?

Count all vowels in string

First Program Tic-Tac-Toe



Can the output of find with the -printf flag be colorized?


Exclude symbolic links to other filesystems with find -mountWhy does printf ignore the IFS when printing out the result of my script?find -print always prints the starting directoryi/o format with printf in bash-shellSolaris find doesn't support printf actionIgnore directories under a certain root while following symlinks with findHow to draw a Divider Line with Name Title before the output displayUsing printf with netcatFind a file and make a symlink to parent using find and -execfind with -prune leaves pruned directory names






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







0















The command



find . -type l -not -xtype l -printf "%p -> %ln"


prints all nonbroken symlinks under the directory .. I want to colorize this output so that the %p part is blue. I've tried



find . -type l -not -xtype l -printf 'e[1;34m%-6se[m' "%p -> %ln"


but this results in the error find: warning: unrecognized escape e. Any ideas how to fix this?










share|improve this question































    0















    The command



    find . -type l -not -xtype l -printf "%p -> %ln"


    prints all nonbroken symlinks under the directory .. I want to colorize this output so that the %p part is blue. I've tried



    find . -type l -not -xtype l -printf 'e[1;34m%-6se[m' "%p -> %ln"


    but this results in the error find: warning: unrecognized escape e. Any ideas how to fix this?










    share|improve this question



























      0












      0








      0








      The command



      find . -type l -not -xtype l -printf "%p -> %ln"


      prints all nonbroken symlinks under the directory .. I want to colorize this output so that the %p part is blue. I've tried



      find . -type l -not -xtype l -printf 'e[1;34m%-6se[m' "%p -> %ln"


      but this results in the error find: warning: unrecognized escape e. Any ideas how to fix this?










      share|improve this question
















      The command



      find . -type l -not -xtype l -printf "%p -> %ln"


      prints all nonbroken symlinks under the directory .. I want to colorize this output so that the %p part is blue. I've tried



      find . -type l -not -xtype l -printf 'e[1;34m%-6se[m' "%p -> %ln"


      but this results in the error find: warning: unrecognized escape e. Any ideas how to fix this?







      find printf






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 14 mins ago









      Inian

      5,8681633




      5,8681633










      asked 56 mins ago









      Brian FitzpatrickBrian Fitzpatrick

      91221123




      91221123






















          1 Answer
          1






          active

          oldest

          votes


















          2














          It is not quite correct, the color code sequence and the %p needs to be in the same argument to -printf and not in separate ones.



          The -printf flag of find is different from the usual built-in from bash. The find version takes arguments of form -printf format while the built-in takes printf <FORMAT> <ARGUMENTS...>, which means they can't be mixed together. The -printf option of find provides various sequences to describe the file attributes. The %s inside the find -printf conveys a different meaning than the format specification definition by the built-in.



          Also I guess the printf from the find (GNU findutils) command only supports ANSI color codes and does not accept the e escape sequences (unlike the built-in printf) but its octal equivalent only



          find . -type l -not -xtype l -printf "33[1;34m%p33[m -> %ln"


          You can add the ANSI color code of your choice to the above.






          share|improve this answer


























            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
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f520306%2fcan-the-output-of-find-with-the-printf-flag-be-colorized%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            It is not quite correct, the color code sequence and the %p needs to be in the same argument to -printf and not in separate ones.



            The -printf flag of find is different from the usual built-in from bash. The find version takes arguments of form -printf format while the built-in takes printf <FORMAT> <ARGUMENTS...>, which means they can't be mixed together. The -printf option of find provides various sequences to describe the file attributes. The %s inside the find -printf conveys a different meaning than the format specification definition by the built-in.



            Also I guess the printf from the find (GNU findutils) command only supports ANSI color codes and does not accept the e escape sequences (unlike the built-in printf) but its octal equivalent only



            find . -type l -not -xtype l -printf "33[1;34m%p33[m -> %ln"


            You can add the ANSI color code of your choice to the above.






            share|improve this answer






























              2














              It is not quite correct, the color code sequence and the %p needs to be in the same argument to -printf and not in separate ones.



              The -printf flag of find is different from the usual built-in from bash. The find version takes arguments of form -printf format while the built-in takes printf <FORMAT> <ARGUMENTS...>, which means they can't be mixed together. The -printf option of find provides various sequences to describe the file attributes. The %s inside the find -printf conveys a different meaning than the format specification definition by the built-in.



              Also I guess the printf from the find (GNU findutils) command only supports ANSI color codes and does not accept the e escape sequences (unlike the built-in printf) but its octal equivalent only



              find . -type l -not -xtype l -printf "33[1;34m%p33[m -> %ln"


              You can add the ANSI color code of your choice to the above.






              share|improve this answer




























                2












                2








                2







                It is not quite correct, the color code sequence and the %p needs to be in the same argument to -printf and not in separate ones.



                The -printf flag of find is different from the usual built-in from bash. The find version takes arguments of form -printf format while the built-in takes printf <FORMAT> <ARGUMENTS...>, which means they can't be mixed together. The -printf option of find provides various sequences to describe the file attributes. The %s inside the find -printf conveys a different meaning than the format specification definition by the built-in.



                Also I guess the printf from the find (GNU findutils) command only supports ANSI color codes and does not accept the e escape sequences (unlike the built-in printf) but its octal equivalent only



                find . -type l -not -xtype l -printf "33[1;34m%p33[m -> %ln"


                You can add the ANSI color code of your choice to the above.






                share|improve this answer















                It is not quite correct, the color code sequence and the %p needs to be in the same argument to -printf and not in separate ones.



                The -printf flag of find is different from the usual built-in from bash. The find version takes arguments of form -printf format while the built-in takes printf <FORMAT> <ARGUMENTS...>, which means they can't be mixed together. The -printf option of find provides various sequences to describe the file attributes. The %s inside the find -printf conveys a different meaning than the format specification definition by the built-in.



                Also I guess the printf from the find (GNU findutils) command only supports ANSI color codes and does not accept the e escape sequences (unlike the built-in printf) but its octal equivalent only



                find . -type l -not -xtype l -printf "33[1;34m%p33[m -> %ln"


                You can add the ANSI color code of your choice to the above.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 4 mins ago

























                answered 28 mins ago









                InianInian

                5,8681633




                5,8681633






























                    draft saved

                    draft discarded




















































                    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%2f520306%2fcan-the-output-of-find-with-the-printf-flag-be-colorized%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

                    Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                    Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                    Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...