Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6354475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:34:53+00:00 2026-05-24T22:34:53+00:00

I have a binary stream on standard input, it’s in a fixed size format,

  • 0

I have a binary stream on standard input, it’s in a fixed size format, a continuos stream of packets, each packet has a header with length X and a body with length Y.

So if X=2 Y=6 then it’s something like 00abcdef01ghijkl02mnopqr03stuvwx, but it’s binary and both the header and data can contain any “characters” (including ‘\0’ and newline), the example is just for readability.

I want to get rid of the header data so the output looks like this: abcdefghijklmnopqrstuvwx.

Are there any commands in the unix toolchain that allow me to do this? And in general are there any tools for handling binary data? The only tool I could think of is od/hexdump but how do you convert the result back to binary?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:34:54+00:00Added an answer on May 24, 2026 at 10:34 pm

    Use xxd which goes to and from a hexdump.

    xxd -c 123 -ps
    

    will output your stream with 123 bytes per line. To reverse use

    xxd -r -p
    

    You should now be able to put this together with cut to drop characters since you can do something like

    cut -c 3-
    

    to get all characters from 3 to the end of a line. Do not forget to use a number of characters equal to 2X to account for two hex characters per byte.

    So something along the lines of

    xxd -c X+Y -ps | cut -c 2X+1- | xxd -r -p
    

    where X+Y and 2X+1 are replaced with actual numerical values. You’ll need to put your datastream somewhere appropriate in to the above command.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a binary stream that has a very high error rate. The error
I have response stream from a ftp web request that returns binary file. I
I have a binary tree where each node can have a value. I want
I have a serial device that has a binary output and I capture the
I have an input stream coming form a blackbox (say B). All the messages
I have to send a binary stream of a blob by means of a
I have a binary protocol with some unknown amount of initial header data (unknown
I want to stream a binary data using python. I do not have any
I have a message object serialized as binary data stream (it can be any
I have a binary file that is really a stack of files, the format

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.