Sponsored Content
Top Forums Shell Programming and Scripting Split a binary file into 2 basing on 2 delemiter string Post 302252614 by Averell on Thursday 30th of October 2008 12:51:39 AM
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!
 

10 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

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

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

10. 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
SQLITE_ESCAPE_STRING(3) 												   SQLITE_ESCAPE_STRING(3)

sqlite_escape_string - Escapes a string for use as a query parameter

SYNOPSIS
string sqlite_escape_string (string $item) DESCRIPTION
sqlite_escape_string(3) will correctly quote the string specified by $item for use in an SQLite SQL statement. This includes doubling up single-quote characters ( ') and checking for binary-unsafe characters in the query string. Although the encoding makes it safe to insert the data, it will render simple text comparisons and LIKE clauses in your queries unusable for the columns that contain the binary data. In practice, this shouldn't be a problem, as your schema should be such that you don't use such things on binary columns (in fact, it might be better to store binary data using other means, such as in files). PARAMETERS
o $item - The string being quoted. If the $item contains a NUL character, or if it begins with a character whose ordinal value is 0x01, PHP will apply a binary encoding scheme so that you can safely store and retrieve binary data. RETURN VALUES
Returns an escaped string for use in an SQLite SQL statement. NOTES
Note Do not use this function to encode the return values from UDF's created using sqlite_create_function(3) or sqlite_create_aggre- gate(3) - use sqlite_udf_encode_binary(3) instead. Warning addslashes(3) should NOT be used to quote your strings for SQLite queries; it will lead to strange results when retrieving your data. SEE ALSO
sqlite_udf_encode_binary(3). PHP Documentation Group SQLITE_ESCAPE_STRING(3)
All times are GMT -4. The time now is 04:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy