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 8172757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:53:20+00:00 2026-06-06T21:53:20+00:00

I have a file with multiple jpegs inside. So i would like to split

  • 0

I have a file with multiple jpegs inside. So i would like to split them to single jpegs.

The easy part is to find the beginning: 0xFF0xD8 0xFF0xE1 marks the beginning of the JPG and the EXIF Data field, which is in my case always at the beginning.

So I found this awk command:

awk '/string/{n++}{print >"out" n ".txt" }' final.txt

To split the files. Which does not work as expected when I use it with hex:

awk '/0xFF0xD8 0xFF0xE1/{n++}{print >"out" n ".txt" }' final.txt

The doc of awk says that all strings with 0x in front are used as hex but I seems not working well..

Edit: well i found this: https://superuser.com/questions/174362/how-to-split-binary-file-based-on-pattern but it does not work for me… it should create 2 files, but only one is created and its only 11 Bytes big

  • 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-06-06T21:53:21+00:00Added an answer on June 6, 2026 at 9:53 pm

    Are you sure awk handles binary files well? I thought it would expect newlines.

    Perl can use hex escapes in regexes (Basic idea from this answer):

    #!/usr/bin/perl
    undef $/;
    $_ = <>;
    $n = 0;
    for $content (split(/(?=\xFF\xD8\xFF\xE0)/)) {
            open(OUT, ">out" . ++$n . ".txt");
            print OUT $content;
            close(OUT);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have merged multiple jpeg files into one single .bin file. ..... ......... while(true){
I have got the requirement to find the core file in multiple box/machine and
I have a file which has multiple columns, whitespace separated. e.g: data1 data2 data3
We have an idl file with multiple interfaces defined, two of which have someting
I have a txt file containing multiple rows of identical size: (Examples) 0123456 789
I have a maven pom.xml file with multiple instances of a same goal defined
I have an ASP.NET MVC page with multiple file uploads. After a failed post,
I have a code where in I first convert a .csv file into multiple
I have an XML file (on the left) and I want to create multiple
I have navigation.html (static coded navigtaion ) file loaded on multiple pages, using jQuery

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.