Sponsored Content
Full Discussion: Editing File Headers
Top Forums Shell Programming and Scripting Editing File Headers Post 302543585 by DGPickett on Monday 1st of August 2011 10:00:27 AM
Old 08-01-2011
Yes, the effect is the same, give or takes some renaming. Update in place destroys the original if anything goes wrong, and requires much more sophisticated tools. Most text tools truncate as they write. You need a very serious language, like PERL or C, to update the middle. Maybe it is a mindset hangover from tape, where, generally, the last thing you wrote is implicitly just before EOF.

A header could contain a file length and checksum as well as data type and format type magic strings, making updates more complex, but they are less popular in audio/video as you do not know these until the end, long after the header is written, and they do not want to go back and update, either.

Getting a patch to the software would be even nicer. I have patched stings in library file object code using a binary find and replace copier, and scary thing is, no checksum alarms went off! Maybe we need secure ELF? But these few bits are harder to locate and may break other things if you change them.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove Headers throughout a data file

I have a data file with over 500,000 records/lines that has the header throughout the file. SEQ_ID Name Start_Date Ins_date Add1 Add2 1 Harris 04/02/08 03/02/08 333 Main Suite 101 2 Smith 02/03/08 01/23/08 287 Jenkins SEQ_ID Name ... (3 Replies)
Discussion started by: psmall
3 Replies

2. Shell Programming and Scripting

Remove text between headers while leaving headers intact

Hi, I'm trying to strip all lines between two headers in a file: ### BEGIN ### Text to remove, contains all kinds of characters ... Antispyware-Downloadserver.com (Germany)=http://www.antispyware-downloadserver.c om/updates/ Antispyware-Downloadserver.com #2... (3 Replies)
Discussion started by: Trones
3 Replies

3. UNIX for Dummies Questions & Answers

reading file headers

Hello, I have done much googling on this, but apparently not using the right keywords. I am assuming there is some kind of header for each file on a disk which stores information such as mod time, access time, etc. I have two questions: 1) is there a way to read this header directly,... (2 Replies)
Discussion started by: Allasso
2 Replies

4. Shell Programming and Scripting

Merging of files with different headers to make combined headers file

Hi , I have a typical situation. I have 4 files and with different headers (number of headers is varible ). I need to make such a merged file which will have headers combined from all files (comman coluns should appear once only). For example - File 1 H1|H2|H3|H4 11|12|13|14 21|22|23|23... (1 Reply)
Discussion started by: marut_ashu
1 Replies

5. Shell Programming and Scripting

Editing headers

Hi, I have a folder that contains many (multiple) files 1.fasta 2.fasta 3.fasta 4.fasta 5.fasta . . 100's of files Each such file have data in the following format for example: vi 1.fasta >AB_1 200bp MLKKPIIIGVTGGSGGGKTSVSRAILDSFPNARIAMIQHDSYYKDQSHMSFEERVKTNYDHPLAFDTDFM... (4 Replies)
Discussion started by: Lucky Ali
4 Replies

6. Shell Programming and Scripting

Multiple headers in a file

Hi , I have a .txt file in which I have multiple headers, the header record starts with $ symbol...like the first column name is $Account. I have to keep the header in the first line and delete all the remaining headers which are in the file. I tried using sort adc.txt | uniq -u , but my... (7 Replies)
Discussion started by: gaur.deepti
7 Replies

7. Shell Programming and Scripting

editing headers

Hi, I have a folder that contains many (multiple) files 1.fasta 2.fasta 3.fasta 4.fasta 5.fasta . . 100's of files Each such file have data in the following format for example: vi 1.fasta 58 390 A GTATACATTATTGATGAAGTCCACATGCTTTCTATGGGTGCCTTCAATGCGCTTTTAAAA (7 Replies)
Discussion started by: Lucky Ali
7 Replies

8. Shell Programming and Scripting

Merging File with headers

Hi I need to merge 4 files. The issue i am facing is all the files have headers and i do not want them in the final output file. Can anybody suggest how to do it? (5 Replies)
Discussion started by: Arun Mishra
5 Replies

9. UNIX for Dummies Questions & Answers

Append file name to fasta file headers in Linux

How do we append the file name to fasta file headers in multiple fasta-files in Linux? (10 Replies)
Discussion started by: Mauve
10 Replies

10. UNIX for Advanced & Expert Users

Cannot find logical file format for BSD file headers.

Hi. Unix rookie here. Been looking for a few days for reference documents on how BSD UNIX lays the logical file format onto a disk. Goal is to view/edit with hex editor for data repair. Lots of docs are available for how to use Unix commands (like xxd), but I want to learn the map of how Unix... (4 Replies)
Discussion started by: Chris_top_he_r
4 Replies
elf_flag(3E)															      elf_flag(3E)

NAME
elf_flagdata, elf_flagehdr, elf_flagelf, elf_flagphdr, elf_flagscn, elf_flagshdr - manipulate flags SYNOPSIS
[flag... ] file... [library] ... DESCRIPTION
These functions manipulate the flags associated with various structures of an ELF file. Given an ELF descriptor elf, a data descriptor data, or a section descriptor scn, the functions may set or clear the associated status bits, returning the updated bits. A null descriptor is allowed, to simplify error handling; all functions return zero for this degenerate case. cmd may have the following values: The functions clear the bits that are asserted in flags. Only the non-zero bits in flags are cleared; zero bits do not change the status of the descriptor. The functions set the bits that are asserted in flags. Only the non-zero bits in flags are set; zero bits do not change the status of the descriptor. Descriptions of the defined flags bits appear below. When the program intends to write an ELF file, this flag asserts the associated information needs to be written to the file. Thus, for example, a program that wished to update the ELF header of an existing file would call with this bit set in flags and cmd equal to A later call to would write the marked header to the file. Normally, the library decides how to arrange an output file. That is, it automatically decides where to place sections, how to align them in the file, etc. If this bit is set for an ELF descriptor, the program assumes responsibility for determining all file positions. This bit is meaningful only for and applies to the entire file associated with the descriptor. When a flag bit is set for an item, it affects all the subitems as well. Thus, for example, if the program sets the bit with the entire logical file is ``dirty.'' EXAMPLES
The following fragment shows how one might mark the ELF header to be written to the output file. SEE ALSO
elf(3E), elf_end(3E), elf_getdata(3E), elf_getehdr(3E), elf_update(3E). elf_flag(3E)
All times are GMT -4. The time now is 12:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy