Questions tagged [xxd]

`xxd` is a Linux Hexdump command

On the Linux platform, the command xxd (available via most package managers) works as a hexdump tool.

From man xxd

xxd creates a hex dump of a given file or standard input. It can also 
convert a hex dump back to its original binary form. Like uuencode(1) and 
uudecode(1) it allows the transmission of binary data in a `mail-safe' ASCII 
representation, but has the advantage of decoding to standard output. 
Moreover, it can be used to perform binary file patching.  
107 questions
29
votes
2 answers

Official Fedora package for 'xxd' command?

I need to use a script based upon xxd, but it's not installed on my Fedora 21: $ xxd bash: xxd: command not found So I tried without success to search and install it: $ yum install xxd (fails) $ yum search xxd (fails) $ yum search all xxd (fails -…
Bludzee
  • 2,733
  • 5
  • 38
  • 46
11
votes
5 answers

Create Binary files in UNIX

This question was out there for a while and I thought I should offer some bonus points if I can get it to work. What did I do… Recently at work, I wrote a parser that would convert a binary file in a readable format. Binary file isn't an Ascii file…
jaypal singh
  • 74,723
  • 23
  • 102
  • 147
9
votes
6 answers

How to search & replace arbitrary literal strings in sed and awk (and perl)

Say we have some arbitrary literals in a file that we need to replace with some other literal. Normally, we'd just reach for sed(1) or awk(1) and code something like: sed "s/$target/$replacement/g" file.txt But what if the $target and/or…
wef
  • 351
  • 3
  • 12
9
votes
5 answers

How to print float value from binary file in shell?

I've binary file consisting double float (8 bytes) or just float (4 bytes) value which was generated in the following way: $ python -c $'from struct import pack\nwith open("file.bin", "wb") as f: f.write(pack("
kenorb
  • 155,785
  • 88
  • 678
  • 743
7
votes
3 answers

Vim modifying a file if used with xxd

I'm trying to understand how ID3 tags work, so, after reading some documentation, I started to look at some mp3's raw data. Vim is usually my editor of choice, so, after some googling, I found out I could use xxd to see an hex representation of my…
gcali
  • 1,178
  • 1
  • 16
  • 26
7
votes
1 answer

diff - find specific change between two values in hex dump

I am analyzing hex data from binary data dumps from a basic command-line program of mine. I'm basically dumping the exact contents of a struct (a large array of structs, actually) to a text file. I then create a second binary dump, and compare the…
Cloud
  • 18,753
  • 15
  • 79
  • 153
5
votes
3 answers

Command to convert hexdump back to text

I am using Catfish to find files containing certain text. Some of the files found instead of plain text contain something which looks like a hex dump: 3c3f 7068 700a 0a66 756e 6374 696f 6e20 7573 6572 5f65 7869 7374 7328 2475 6e29 207b 0a09 7265…
Majid Fouladpour
  • 29,356
  • 21
  • 76
  • 127
5
votes
1 answer

How to make a valid input for "xxd -r" in vim when removing a byte?

Create a file named as test containing the following content: 0123456789abcdef0123456789abcdef I want to remove the first 0 with the use of xxd. Open it with vim -b test then run :%!xxd inside vim. The result is: 0000000: 3031 3233 3435 3637 3839…
Jingguo Yao
  • 7,320
  • 6
  • 50
  • 63
4
votes
1 answer

qmake: extra compilers (processing steps)?

In my qmake-based project, I want to run 'xxd' on some files before compilation. Following the documentation, the relevant part in my pro file looks as following: SHADERS = shader/tone.frag \ shader/trans.frag \ …
Ancurio
  • 1,698
  • 1
  • 17
  • 32
3
votes
1 answer

How best can I programmatically apply `__attribute__ ((unused))` to these auto-generated objects?

In my makefile I have the following target, which "compiles" text/HTML resources into unsigned char arrays using xxd -i. I wrap the result in an anonymous namespace and header guards for multiple-inclusion safety both inside and between translation…
Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
3
votes
0 answers

How to create a .bin file from binary .txt file?

I want to create a binary.bin file from a binary.txt file. The .txt file only contains ones and zeroes. I found a way of converting hexadecimal into .bin using the xxd linux function but can not find a method for converting .txt zeroes and ones to…
3
votes
1 answer

Best OCR For Hexdumps

I am looking for a way in which it is possible to extract the left side of the image (the non ascii characters) here, reliably, using OCR. I have a number of images in a similar format, also showing hex data, that i would like to extract. Would…
dipl0
  • 1,017
  • 2
  • 13
  • 36
3
votes
3 answers

How to make a hexdump line by line with xxd?

To create sample file with cat. cat > /tmp/test.txt < X1 > X22 > X333 > X4444 > EOF To check the content in sample file. cat /tmp/test.txt X1 X22 X333 X4444 To make a hexdump with xxd. xxd /tmp/test.txt 0000000: 5831 0a58 3232 0a58 3333…
showkey
  • 482
  • 42
  • 140
  • 295
3
votes
1 answer

How do I make xxd -r work with the output of xxd -i?

Can some propose a workaround for this bug: cat /bin/ls |xxd -g 1 -i | xxd -r xxd: sorry, cannot seek backwards. But if you do: cat /bin/ls |xxd -g 1 | xxd -r It is ok. Is this a bug? In the past I was able to execute this, but now I am just…
Peter Teoh
  • 6,337
  • 4
  • 42
  • 58
3
votes
1 answer

Convert hex to binary and send it over network

I need to read hexadecimal data from stdin, convert it to binary, send with netcat, recieve reply, convert back to hex and print to stdout. I do: # xxd -r -p | nc -u localhost 12345 | xxd Then type my data in hex and press Enter. But it is not sent…
Ivan
  • 63
  • 1
  • 5
1
2 3 4 5 6 7 8