08-15-2013
Hello,
I've helped several times in this forum before and I know if somebody wants to help, helps. If somebody ask here there is not a forum rule to make attemtps before posting, due that sometimes the people just don't know where to begin. I'm asking and requesting help here (not complete solution) because I don't know in Python or any other language.
I only have the idea to extract the byte sequences searching regular expressions because not always the sequences are in the same position, but I don't know
in which language would be easier, faster, better and how to begin.
I'm using Ubuntu or Windows, but I'm asking for help and suggestions in bash if it possible or in Perl, Python, C or any language to handle binaries and be able
to extract the byte sequences I mention.
Maybe if someone knows how to do it in any language, could give some examples to follow and continue by myself.
I posted before but now I ask thinking in another approach, but still searching the way to extract the info reading the binary directly
without converting to text.
Thanks in advance for any help.
Last edited by Ophiuchus; 08-15-2013 at 01:58 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
Does anybody know or guide me on how to remove the first N bytes and the last N bytes from a binary file? Is there any AWK or SED or any command that I can use to achieve this?
Your help is greatly appreciated!!
Best Regards,
Naveen. (1 Reply)
Discussion started by: naveendronavall
1 Replies
2. UNIX for Advanced & Expert Users
Hello,
I have come across the necessity for me to deal with binary sequences and I had a few questions.
1- Does any UNIX scripting language provide any tool or command for converting text data to binary sequences? Example of binary sequence: "0x97 0x93 0x85 0x40 0xd5 0xd6 0xd7"
2- If I want... (2 Replies)
Discussion started by: Indalecio
2 Replies
3. Shell Programming and Scripting
Hi,
I have an one-line file consisting of a sequence of 660 letters. I would like to extract 9-letter blocks iteratively:
ASDFGHJKLQWERTYUIOPZXCVBNM
first block: ASDFGHJKL
1nd block: SDFGHJKLQ
What I have so far only gives me the first block, can anyone please explain why?
cat... (7 Replies)
Discussion started by: solli
7 Replies
4. Shell Programming and Scripting
Hi,
This is part of a large text file I need to separate out.
I'd like some help to build a shell script that will extract the text between sets of dashed lines, write that to a new file using the whole or part of the first text string as the new file name, then move on to the next one and... (7 Replies)
Discussion started by: cajunfries
7 Replies
5. Linux
The title is clear: why does ext3 allocate 8 blocks for files that are few bytes long?
If I create a file named "test", put a few chars in it, and then I run:
stat test
I get that "Blocks: 8"
I searched in the web and found that ext does that, it allocates 8 blocks even if It doesn't need... (4 Replies)
Discussion started by: Tavo
4 Replies
6. UNIX for Dummies Questions & Answers
Hello guys. I really hope someone will help me with this one..
So, I have to write this script who:
- creates a file home/student/vmdisk of 10 mb
- formats that file to ext3
- mounts that partition to /mnt/partition
- creates a file /mnt/partition/data. In this file, there will... (1 Reply)
Discussion started by: razolo13
1 Replies
7. Shell Programming and Scripting
Hi,
I have a file with more than 28000 records and it looks like below..
>mm10_refflat_ABCD range=chr1:1234567-2345678
tgtgcacactacacatgactagtacatgactagac....so on
>mm10_refflat_BCD range=chr1:3234567-4545678...
tgtgcacactacacatgactagtatgtgcacactacacatgactagta
.
.
.
.
.
so on
... (2 Replies)
Discussion started by: Diya123
2 Replies
8. Shell Programming and Scripting
I have a fastq file from small RNA sequencing with sequence lengths between 15 - 30. I wanted to filter sequence lengths between 21-25 and write to another fastq file. how can i do that? (4 Replies)
Discussion started by: empyrean
4 Replies
9. Shell Programming and Scripting
I have a text file, input.fasta contains some protein sequences. input.fasta is shown below.
>P02649
MKVLWAALLVTFLAGCQAKVEQAVETEPEPELRQQTEWQSGQRWELALGRFWDYLRWVQT
LSEQVQEELLSSQVTQELRALMDETMKELKAYKSELEEQLTPVAEETRARLSKELQAAQA
RLGADMEDVCGRLVQYRGEVQAMLGQSTEELRVRLASHLRKLRKRLLRDADDLQKRLAVY... (8 Replies)
Discussion started by: rahim42
8 Replies
10. Shell Programming and Scripting
I sat down yesterday to write this script and have just realised that my methodology is broken........
In essense I have.....
----------------------------------------------------------------- (This line really is in the file)
Service ID: 12345 ... (7 Replies)
Discussion started by: Bashingaway
7 Replies
LEARN ABOUT DEBIAN
stralloc
stralloc(3) Library Functions Manual stralloc(3)
NAME
stralloc - dynamically allocated strings
SYNTAX
#include <stralloc.h>
int stralloc_ready(&sa,len);
int stralloc_readyplus(&sa,len);
int stralloc_copy(&sa,&sa2);
int stralloc_copys(&sa,buf);
int stralloc_copyb(&sa,buf,len);
int stralloc_cat(&sa,&sa2);
int stralloc_cats(&sa,buf);
int stralloc_catb(&sa,buf,len);
int stralloc_append(&sa,buf);
int stralloc_0(&sa);
int stralloc_starts(&sa,buf);
stralloc sa = {0};
stralloc sa2 = {0};
unsigned int len;
char *buf;
DESCRIPTION
A stralloc variable holds a string in dynamically allocated space. String length is limited only by memory. String contents are unre-
stricted.
The stralloc structure has three components: sa.s is a pointer to the string, or 0 if it is not allocated; sa.len is the number of bytes in
the string, if it is allocated; sa.a is the number of bytes allocated for the string, if it is allocated. A stralloc variable should be
initialized to {0}, meaning unallocated.
stralloc_ready makes sure that sa has enough space allocated for len characters. It allocates extra space if necessary.
stralloc_readyplus makes sure that sa has enough space allocated for len characters more than its current length. If sa is unallocated,
stralloc_readyplus is the same as stralloc_ready.
stralloc_copy copies sa2 to sa, allocating space if necessary. Here sa2 is an allocated stralloc variable.
stralloc_copys copies a 0-terminated string, buf, to sa, without the 0.
stralloc_copyb copies len characters from buf to sa.
stralloc_cat appends sa2 to sa, allocating space if necessary. If sa is unallocated, stralloc_cat is the same as stralloc_copy.
stralloc_cats and stralloc_catb are analogous to stralloc_copys and stralloc_copyb.
stralloc_append adds a single character, *buf, to sa, allocating space if necessary.
stralloc_0 adds a single 0 character to sa.
stralloc_starts returns 1 if the 0-terminated string buf, without the 0, is a prefix of sa.
ERROR HANDLING
If a stralloc routine runs out of memory, it leaves sa alone and returns 0, setting errno appropriately. On success it returns 1; this
guarantees that sa is allocated.
SEE ALSO
alloc(3), error(3)
stralloc(3)