Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've got a text file that I'm trying to debug an encoding issue in. I ran the file through od -c and got the following output:

3457540  ,   "   t   e   x   t   "   :   "   302 241   Q   u 303 251

My understanding from the man page is that -c "select[s] ASCII characters or backslash escapes." I guess I don't understand what a backslash escape is. I would have assumed it to be a C-string style escaped character, such as \0 or \n. However, I'm getting values (302 and 303) that are clearly out of the range of a byte. Could somebody explain what's happening here?

share|improve this question
1  
Guess what o means in od ;-) –  jlliagre Mar 14 at 22:01
1  
@jlliagre Yeah, I knew that it meant octal dump, but apparently I'm having a derp day. –  Eric Andres Mar 14 at 23:22

1 Answer 1

up vote 5 down vote accepted

Those numbers are octal (base 8) It'll only backslash something that has a symbolic name (\n, \b, \t, etc.)

(I prefer hd -- hexdump -C -- myself.)

share|improve this answer
    
Ah, I forgot that a lot of these tools were written for octal first. That would explain the oddball numbers. Thanks, hd looks like the better option. FYI, the -c switch is lower case (at least on Ubuntu). –  Eric Andres Mar 14 at 21:38
    
No, lowercase "c" is different from uppercase for the parent hexdump application. –  Ricky Beam Mar 14 at 21:41
    
You're right. I was thinking hd was an alias for hexdump. Thanks again. –  Eric Andres Mar 14 at 21:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.