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;
}
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
New contributor
add a comment |
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
New contributor
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 a comment |
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
New contributor
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
grep ack
New contributor
New contributor
edited 34 mins ago
Nasir Riley
3,8302 gold badges4 silver badges11 bronze badges
3,8302 gold badges4 silver badges11 bronze badges
New contributor
asked 40 mins ago
xotonicxotonic
11 bronze badge
11 bronze badge
New contributor
New contributor
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 a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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)
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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)
add a comment |
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)
add a comment |
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)
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)
answered 23 mins ago
steeldriversteeldriver
42.7k5 gold badges56 silver badges94 bronze badges
42.7k5 gold badges56 silver badges94 bronze badges
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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