reading file headers


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers reading file headers
# 1  
Old 04-27-2009
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, ie, not just getting the information via stat or something like that, but to actually look at the header? eg, I tried doing xxd on a text file, and it only gives the readable file content. I would like to see what the header looks like. (If header is the right word) I would like to be able to do this on the command line.

2) There also must be a way to download only the "header" of a file via http, as wget does this when using the -N option, to check the mod time and see if the file should be downloaded or not. How do I do this directly?

Info or pointers very much appreciated.

Allasso
# 2  
Old 04-27-2009
To start with - look into
Code:
man dirent

This only gets directory information.

Basically - the data you are talking about is only available in kernel mode. What you want to do is look into the filesystem code for your box - ufs, ffs, ext2, or whatever.

Google for 'McKusick fast file system' to see what I'm talking about - there are some videos.
# 3  
Old 04-27-2009
thanks. Have any ideas on how wget gets this information via http?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

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

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

4. Shell Programming and Scripting

Modify record headers from file

Dear All I was wondering if anybody is able to help me with a script I am struggling with. I have to add comments to the "head-lines" (start with >) from an other file according to the ID tag. Only the head lines should be modified. cat File.txt >H1_A1_A2_A3_A4_ID1_A5 A:B:C:S:E:E:K... (4 Replies)
Discussion started by: loba
4 Replies

5. Shell Programming and Scripting

Editing File Headers

Hey Guys, Absolute neewbie here. I am trying to see if it is possible to edit headers/meta-data of files in Mac OSX. I am basically trying to change an audio file header to read 16bit instead of 24bit. We have an issue with some of our software and it regularly exports 16bit audio files with... (3 Replies)
Discussion started by: andysuperaudiom
3 Replies

6. Shell Programming and Scripting

Replacing headers based on a second file

I have a file with thousands of sequences that looks like this: I need to replace the headers using a second file Thus, I will end up having the following file: I am looking for an AWK script that I can easily plug in my current pipeline. Any help will be greatly appreciated! (6 Replies)
Discussion started by: Xterra
6 Replies

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

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

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

10. 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
Login or Register to Ask a Question