How to grep contents in HEX specifying the pattern in decimals?grep only subdirectories matching patternGrep...

Is it unusual for a math department not to have a mail/web server?

Half filled water bottle

Talk interpreter

How do we improve collaboration with problematic tester team?

Is the internet in Madagascar faster than in UK?

Do sharpies or markers damage soft rock climbing gear?

Will removing shelving screws from studs damage the studs?

Why does this London Underground poster from 1924 have a Star of David atop a Christmas tree?

Are there any to-scale diagrams of the TRAPPIST-1 system?

Why does Windows store Wi-Fi passwords in a reversible format?

Does the Reduce option from the Enlarge/Reduce spell cause a critical hit to do 2d4 less damage?

Can MuseScore be used programmatically?

助けてくれて有難う meaning and usage

Federal Pacific 200a main panel problem with oversized 100a 2pole breaker

Did ancient peoples ever hide their treasure behind puzzles?

Force SQL Server to use fragmented indexes?

Toroidal Heyacrazy: Rainstorm

Units in general relativity

Shift lens vs move body?

Book featuring a child learning from a crowdsourced AI book

How many petaflops does it take to land on the moon? What does Artemis need with an Aitken?

Why does matter stay collapsed in the core, following a supernova explosion?

Find most "academic" implementation of doubly linked list

Should I use the words "pyromancy" and "necromancy" even if they don't mean what people think they do?



How to grep contents in HEX specifying the pattern in decimals?


grep only subdirectories matching patternGrep multiple pattern negative matchHow to do max-depth search in ack and grep?How to search multiple Pattern in grep while ignoring the first pattern if appearing consecutivelyHow do I ack-grep exclude file type *.sql files or file size larger than >3MB?Grep to filter and show only the beginning of a linegrep - the multiline pattern writingGrep Pattern and the next wordgrep for contents AFTER pattern in delimiterGrep contents before a colon






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







0















I have a file with the following contents (as a text file in UTF-8)



e04ba1af81d887979ddcee1dc23f2531
43f85926fdb6a668386ee354f8b836a1
b53614f5139c052ec08ea1ecd2532daf
e9b3914d7b1e1bf8e6feab621330245b
bbcad02116316176385fbfb294ee77b4


I need to ensure that this file contains a number 46390 (decimal). It equals b536 in HEX that is the beginning of the 3rd line. How do I use grep or ack to make it convert both file and pattern to binary representation and then do a search? Roughly saying, to make searching base independent considering that bases are known.










share|improve this question









New contributor



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






















  • Add the expected output to your question.

    – Nasir Riley
    36 mins ago











  • each of the 5 numbers in your example are very much larger than 46390

    – jsotola
    22 mins ago




















0















I have a file with the following contents (as a text file in UTF-8)



e04ba1af81d887979ddcee1dc23f2531
43f85926fdb6a668386ee354f8b836a1
b53614f5139c052ec08ea1ecd2532daf
e9b3914d7b1e1bf8e6feab621330245b
bbcad02116316176385fbfb294ee77b4


I need to ensure that this file contains a number 46390 (decimal). It equals b536 in HEX that is the beginning of the 3rd line. How do I use grep or ack to make it convert both file and pattern to binary representation and then do a search? Roughly saying, to make searching base independent considering that bases are known.










share|improve this question









New contributor



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






















  • Add the expected output to your question.

    – Nasir Riley
    36 mins ago











  • each of the 5 numbers in your example are very much larger than 46390

    – jsotola
    22 mins ago
















0












0








0








I have a file with the following contents (as a text file in UTF-8)



e04ba1af81d887979ddcee1dc23f2531
43f85926fdb6a668386ee354f8b836a1
b53614f5139c052ec08ea1ecd2532daf
e9b3914d7b1e1bf8e6feab621330245b
bbcad02116316176385fbfb294ee77b4


I need to ensure that this file contains a number 46390 (decimal). It equals b536 in HEX that is the beginning of the 3rd line. How do I use grep or ack to make it convert both file and pattern to binary representation and then do a search? Roughly saying, to make searching base independent considering that bases are known.










share|improve this question









New contributor



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











I have a file with the following contents (as a text file in UTF-8)



e04ba1af81d887979ddcee1dc23f2531
43f85926fdb6a668386ee354f8b836a1
b53614f5139c052ec08ea1ecd2532daf
e9b3914d7b1e1bf8e6feab621330245b
bbcad02116316176385fbfb294ee77b4


I need to ensure that this file contains a number 46390 (decimal). It equals b536 in HEX that is the beginning of the 3rd line. How do I use grep or ack to make it convert both file and pattern to binary representation and then do a search? Roughly saying, to make searching base independent considering that bases are known.







grep ack






share|improve this question









New contributor



xotonic 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



xotonic 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 34 mins ago









Nasir Riley

3,8302 gold badges4 silver badges11 bronze badges




3,8302 gold badges4 silver badges11 bronze badges






New contributor



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








asked 40 mins ago









xotonicxotonic

11 bronze badge




11 bronze badge




New contributor



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




New contributor




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


















  • Add the expected output to your question.

    – Nasir Riley
    36 mins ago











  • each of the 5 numbers in your example are very much larger than 46390

    – jsotola
    22 mins ago





















  • Add the expected output to your question.

    – Nasir Riley
    36 mins ago











  • each of the 5 numbers in your example are very much larger than 46390

    – jsotola
    22 mins ago



















Add the expected output to your question.

– Nasir Riley
36 mins ago





Add the expected output to your question.

– Nasir Riley
36 mins ago













each of the 5 numbers in your example are very much larger than 46390

– jsotola
22 mins ago







each of the 5 numbers in your example are very much larger than 46390

– jsotola
22 mins ago












1 Answer
1






active

oldest

votes


















1















How about simply using printf to do the conversion?



printf '^%xn' 46390 | grep -f- file


(I don't see hoe converting both to binary would help)






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


    }
    });






    xotonic 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%2f537782%2fhow-to-grep-contents-in-hex-specifying-the-pattern-in-decimals%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









    1















    How about simply using printf to do the conversion?



    printf '^%xn' 46390 | grep -f- file


    (I don't see hoe converting both to binary would help)






    share|improve this answer






























      1















      How about simply using printf to do the conversion?



      printf '^%xn' 46390 | grep -f- file


      (I don't see hoe converting both to binary would help)






      share|improve this answer




























        1














        1










        1









        How about simply using printf to do the conversion?



        printf '^%xn' 46390 | grep -f- file


        (I don't see hoe converting both to binary would help)






        share|improve this answer













        How about simply using printf to do the conversion?



        printf '^%xn' 46390 | grep -f- file


        (I don't see hoe converting both to binary would help)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 23 mins ago









        steeldriversteeldriver

        42.7k5 gold badges56 silver badges94 bronze badges




        42.7k5 gold badges56 silver badges94 bronze badges

























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










            draft saved

            draft discarded


















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













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












            xotonic 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%2f537782%2fhow-to-grep-contents-in-hex-specifying-the-pattern-in-decimals%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...

            Ciclooctatetraenă Vezi și | Bibliografie | Meniu de navigare637866text4148569-500570979m