Split a binary file into 2 basing on 2 delemiter string


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Split a binary file into 2 basing on 2 delemiter string
# 1  
Old 10-30-2008
Java Split a binary file into 2 basing on 2 delemiter string

Hi all,

I have a binary file (orig.dat) and two special delimiter strings 'AAA' and 'BBB'. My binary file's content is as follow:
<Data1.1>AAA<Data1.2>BBB
<Data2.1>AAA<Data2.2>BBB
...
<DataN.1>AAA<DataN.2>BBB
DataX.Y might have any length, and contains any kind of special/printable characters.

Now I want to split this file into 2 files F1.dat and F2.dat, content of file 1 should be:
<Data1.1>
<Data2.1>
...
<DataN.1>

content of file 2 should be
<Data1.2>
<Data2.2>
...
<DataN.2>

Could you please help suggest me a way to do this.

Thank you very much!
# 2  
Old 10-30-2008
See this thread: How to hide SSH version
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

C program to read a binary file and search for a string?

Hi, I am not a C programmer. The only C exposure I have is reading and completing the exercises from the C (ANSI C ) Programming Language book:o At the moment, I am using the UNIX strings command to extract information for a binary file and grepping for a particular string and the value... (3 Replies)
Discussion started by: newbie_01
3 Replies

2. UNIX for Dummies Questions & Answers

Deleting file basing on the timestamp substring in the file name

Hello, I have in my backup folder, files with names convention like this : randomFileNames_13-02-2014_23h13m09+1392333189 randomFileNames_14-02-2014_02h13m09+1392343989 randomFileNames_14-02-2014_04h13m09+1392351189 etc.... Base on timestamp at end of the filename, I would to delete all the... (7 Replies)
Discussion started by: thuyetti
7 Replies

3. Shell Programming and Scripting

Pick a line in file 2 basing on array in file1

Dear friends, I have two files. One with all IDs(in a single field) . And another with data(of which say field 5 is ID). I want to create an array of IDs using first file and while reading second file if the ID appears in the array I need to print $0 else skip. After a long gap I am... (6 Replies)
Discussion started by: paresh n doshi
6 Replies

4. UNIX for Dummies Questions & Answers

Split binary file every occurrence of a group of characters

Hello I am new to scripts, codes, bash, terminal, etc. I apologize this my be very scattered because I frankly don't have any idea where to begin and I have had trouble sleeping lately. I have several 2GB files I wish to split. This Code 00 00 01 BA ** ** ** ** ** ** ** ** C3 F8 00 00 01 BB 00... (17 Replies)
Discussion started by: PatrickE
17 Replies

5. Solaris

A string in a binary file

hi experts, anyone knows how can i find a string in a multiple binary files in a multiple directories and display the file name containing the string? i mean i have lots of folders with binary files and i am looking for specific string within one of these files i would like to know the right... (6 Replies)
Discussion started by: q8devilish
6 Replies

6. Shell Programming and Scripting

split a string and convert to binary

Hi All, Iam new to unix scripting and I want a split a string into 4 characters each, leaving the last two characters and convert the splitted values into binary. For example: string='ffd80012ffe20000ffebfffeffea0007fff0ffd70014fff1fff0fff0fff201' this should split as ffd8 0012 ffe2 . .... (5 Replies)
Discussion started by: srinivasayedla
5 Replies

7. UNIX for Advanced & Expert Users

Insert string in binary file at top

How can i append a EBCDIC string of 100 bytes to 0th position of a binary file in UNIX. (4 Replies)
Discussion started by: param_it
4 Replies

8. Shell Programming and Scripting

Split binary file with pattern

Hello! Have some problem with extract files from saved session. File contains any kind of special/printable characters. DATA NumberA DATA DATA Begin DATA1.1 DATA1.2 NumberB1 DATA1.3 DATA1.4 End DATA DATA DATA Begin DATA2.1 DATA2.2 NumberB2 DATA2.3 DATA2.4 End DATA DATA ... (4 Replies)
Discussion started by: vvild
4 Replies

9. Shell Programming and Scripting

Split a single file into several others basing on the last column

Hi folks, Happy new year. I have a file 'filename' that i wd like to split basing on the contents in the last column. The 'filename' content looks like 256772744788,9,11 256772744805,9,11 256772744792,9,11 256775543055,10,12 256782625357,9,12 256772368953,10,13 256772627735,10,13... (3 Replies)
Discussion started by: jerkesler
3 Replies

10. Shell Programming and Scripting

replace string in binary file

Dear all, How can replace special string with another string in binary file? Thanks&Best Regards (2 Replies)
Discussion started by: sg1207
2 Replies
Login or Register to Ask a Question