2

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?

2
  • 1
    Guess what o means in od ;-)
    – jlliagre
    Commented Mar 14, 2014 at 22:01
  • 1
    @jlliagre Yeah, I knew that it meant octal dump, but apparently I'm having a derp day. Commented Mar 14, 2014 at 23:22

1 Answer 1

5

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.)

3
  • 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). Commented Mar 14, 2014 at 21:38
  • No, lowercase "c" is different from uppercase for the parent hexdump application.
    – Ricky
    Commented Mar 14, 2014 at 21:41
  • You're right. I was thinking hd was an alias for hexdump. Thanks again. Commented Mar 14, 2014 at 21:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .