Sponsored Content
Top Forums Shell Programming and Scripting Extract sequences of bytes from binary for differents blocks Post 302843356 by wisecracker on Tuesday 13th of August 2013 02:33:47 AM
Old 08-13-2013
Depending on the size of the file see if this idea will help you:-

https://www.unix.com/shell-programmin...ipulation.html

If you intend to attempt to put the binary values into a _string_variable_ then 0, (zero), is not possible directly under bash, all other values are possible. You will have to detect the 0's and slot in "\0" instead.

So from the 256 bytes of DEMO data in the pointer above only 255, (1 to 255), can be placed into a _variable_. It is easy to add 2 more bytes to represent a 0 as mentioned above but makes the DEMO string 257 bytes in size...

However transferring to another binary file is easy as shown in the DEMO...

Hope this will help you...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove first N bytes and last N bytes from a binary file on AIX.

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

Deal with binary sequences

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

Extract sequence blocks

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

extract blocks of text from a file

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

Why does ext3 allocate 8 blocks for files that are few bytes long

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

X bytes of 0, Y bytes of random data, Z bytes of 5, T bytes of 1. ??

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

Extract sequences based on the list

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

Extract length wise sequences from fastq file

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

Extract the part of sequences from a file

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

Blocks of text in a file - extract when matches...

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
DACS_LIST_JURISDICTI(8) 				     DACS Web Services Manual					   DACS_LIST_JURISDICTI(8)

NAME
dacs_list_jurisdictions - display information about DACS jurisdictions SYNOPSIS
dacs_list_jurisdictions [dacsoptions[1]] DESCRIPTION
This web service is part of the DACS suite. The dacs_list_jurisdictions web service displays information, relative to the jurisdiction that receives the request, about its federation and other jurisdictions in that federation. Included are the federation's public encryption key and its unique instance identifier. The FORMAT argument (see dacs.services(8)[2]) determines the type of output, with the default being HTML, using the style sheet dacs_list_jurisdictions.css[3]. The various flavours of XML, a PHP format (see below), JSON, and plain text (TEXT) are supported. One application of dacs_list_jurisdictions is to assist middleware to generate a menu of jurisdictions for user authentication. If FORMAT is PHP, a list of each jurisdiction that provides an authentication service is emitted (as text/plain, one jurisdiction per line. Each line has the format: jurisdiction[]=jname&host[]=url&jname The string jname is the DACS jurisdiction name and url is the complete URL prefix for DACS web services at the jurisdiction. For example, invoking this URL: https://example.com/infocards/cgi-bin/dacs/dacs_list_jurisdictions?FORMAT=PHP might return the following response: jurisdiction[]=INFOCARDS&host[]=https://example.com/infocards/cgi-bin/dacs&INFOCARDS jurisdiction[]=DEMO&host[]=https://example.com/demo/cgi-bin/dacs&DEMO jurisdiction[]=TEST&host[]=https://test.example.com/cgi-bin/dacs&TEST The html/examples/login.php[4] template demonstrates this feature. If XML output is selected, a document conforming to dacs_list_jurisdictions.dtd[5] is returned. When returned as an XML attribute, a public encryption key is a base-64 encoding of the PEM formatted key. Note This program is also available as a DACS utility, dacslist(1)[6]. Because dacs_admin(8)[7] provides the same functionality and more, dacs_list_jurisdictions may be removed in a future release. Web Service Arguments In addition to the standard CGI arguments[8], dacs_list_jurisdictions understands the following CGI arguments: JURISDICTION Limit the output to the specified jurisdiction name. As a special case, if the argument does not specify a jurisdiction name, only federation-scoped information will be returned. PUB_KEY_ONLY If this argument is "yes" (case insensitive) only the federation's or a jurisdiction's public key (if known) will be returned. If JURISDICTION is given and is not the empty string, that jurisdiction name is selected; if JURISDICTION is given and is the empty string, the federation is selected; and if the argument is absent, the current jurisdiction is selected. This argument currently requires FORMAT to be TEXT. A PEM [RFC 1421[9], RFC 1422[10], RFC 1423[11], RFC 1424[12]] formatted key is returned. Note In the current implementation, a jurisdiction's public key can only be provided by one of the jurisdictions configured on the same host. FILES
dacs_list_jurisdictions.css[3] DIAGNOSTICS
The program exits 0 if everything was fine, 1 if an error occurred. SEE ALSO
dacs(1)[13], dacskey(1)[14], dacslist(1)[6], dacs.groups(5)[15] AUTHOR
Distributed Systems Software (www.dss.ca[16]) COPYING
Copyright2003-2012 Distributed Systems Software. See the LICENSE[17] file that accompanies the distribution for licensing information. NOTES
1. dacsoptions http://dacs.dss.ca/man/dacs.1.html#dacsoptions 2. dacs.services(8) http://dacs.dss.ca/man/dacs.services.8.html#FORMAT 3. dacs_list_jurisdictions.css http://dacs.dss.ca/man//css/dacs_list_jurisdictions.css 4. html/examples/login.php http://dacs.dss.ca/man/../examples/login.php 5. dacs_list_jurisdictions.dtd http://dacs.dss.ca/man/../dtd-xsd/dacs_list_jurisdictions.dtd 6. dacslist(1) http://dacs.dss.ca/man/dacslist.1.html 7. dacs_admin(8) http://dacs.dss.ca/man/dacs_admin.8.html 8. standard CGI arguments http://dacs.dss.ca/man/dacs.services.8.html#standard_cgi_args 9. RFC 1421 http://www.rfc-editor.org/rfc/rfc1421.txt 10. RFC 1422 http://www.rfc-editor.org/rfc/rfc1422.txt 11. RFC 1423 http://www.rfc-editor.org/rfc/rfc1423.txt 12. RFC 1424 http://www.rfc-editor.org/rfc/rfc1424.txt 13. dacs(1) http://dacs.dss.ca/man/dacs.1.html 14. dacskey(1) http://dacs.dss.ca/man/dacskey.1.html 15. dacs.groups(5) http://dacs.dss.ca/man/dacs.groups.5.html 16. www.dss.ca http://www.dss.ca 17. LICENSE http://dacs.dss.ca/man/../misc/LICENSE DACS 1.4.27b 10/22/2012 DACS_LIST_JURISDICTI(8)
All times are GMT -4. The time now is 06:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy