search

Home  >  Q&A  >  body text

Can hexadecimal content be displayed as ASCII characters in vim?

I have a data log file, which is hexadecimal characters and uses spaces as delimiters:

48 54 54 50 2F 31 2E 31 20 34 30 34 20 4E 6F 74 20 46 6F 75 6E 64 0D 0A 53 65 72 76 65 72 3A 20 6E 67 69 6E 78 2F 31 2E 37 2E 39 0D 0A 44 61 74 65 3A 20 53 75 6E 2C 20 30 36 20 53 65 70 20 32 30 31 35 20 30 33 3A 30 35 3A 30 37 20 47 4D 54 0D
.. ..

The actual content is an HTTP response message. Can it be displayed as ASCII characters in vim? Just like in wireshark:

天蓬老师天蓬老师2743 days ago735

reply all(2)I'll reply

  • 某草草

    某草草2017-05-16 16:40:46

    Sorry, I misunderstood your question at first. Assume that your vim storage is as shown above
    Execute

    :%!xxd -r -ps
    :%!xxd

    Then it is the format you have below

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-16 16:40:46

    :%!xxd is converted to hexadecimal and displayed in the mode you mentioned
    :%!xxd -r is returned to the previous display mode
    I haven’t used it for a long time. Give it a try

    reply
    0
  • Cancelreply