Sponsored Content
Full Discussion: reading file headers
Top Forums UNIX for Dummies Questions & Answers reading file headers Post 302310939 by Allasso on Monday 27th of April 2009 11:25:52 AM
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
 

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

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

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

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

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

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
Perlbal::Manual::Debugging(3pm) 			User Contributed Perl Documentation			   Perlbal::Manual::Debugging(3pm)

NAME
Perlbal::Manual::Debugging - Debugging Perlbal VERSION Perlbal 1.78. DESCRIPTION Perlbal has two ways of debugging. One of them is through a management console; the other is through debugging messages. Debugging in a console You'll need to set up a management service and use it to dump all the information you require. The comprehensive documentation on this process can be found at Perlbal::Manual::Management. Debugging messages You can control the ammount of debugging messages Perlbal dumps by setting the environment variable "PERLBAL_DEBUG" to a value between 0 and 4: PERLBAL_DEBUG = 0 # no debug PERLBAL_DEBUG = 4 # debug everything Debug level 1 You can activate basic debug by setting "PERLBAL_DEBUG" to 1: PERLBAL_DEBUG = 1 The following debugging messages are turned on: o When a connection to a backend is closed, Perlbal::BackendHTTP prints "Backend $self is done; closing..." o When a connection to a backend is killed, Perlbal::ClientProxy prints "Client ($self) closing backend ($backend)" o When an HTTP request fails to be parsed, Perlbal::HTTPHeaders prints "HTTP parse failure: $reason" o When the connection is promoted to SSL, Perlbal::TCPListener prints " .. socket upgraded to SSL!" Debug level 2 By setting the debug level to 2 you'll get all the messages from level 1. PERLBAL_DEBUG = 2 You will also get a few others: o When a connection to a backend is opened and ready to be written to, Perlbal::BackendHTTP prints "Backend $self is writeable!" o When a response is about to be handled, Perlbal::BackendHTTP prints "BackendHTTP: handle_response" o When a backend is ready to be read from, Perlbal::BackendHTTP prints "Backend $self is readable!" o When there's an error with the connection to the backend, Perlbal::BackendHTTP prints "BACKEND event_err" o Whenever we're determining if we should be sending keep-alive header information back to the client, Perlbal::ClientHTTPBase prints "ClientHTTPBase::setup_keepalive($self)" o Whenever the client is ready for more of its file, Perlbal::ClientHTTPBase prints "REPROXY SSL done" o Right after we've read a chunk of a file and when a reproxy request is about to be sent, Perlbal::ClientHTTPBase prints "REPROXY Sent: $sent" o When we've written all data in the queue (and are about to stop waiting for write notifications), Perlbal::ClientHTTPBase prints "All writing done to $self" o Whenever a client proxy is about to be closed, Perlbal::ClientProxy prints "Perlbal::ClientProxy closed", followed by a possible "again" and a possible "saying $reason" o When a client has disconnected, Perlbal::ClientProxy prints "ClientProxy::client_disconnected" o When a backend requests a client of a high priority request and the client is available, "Service" in Perlbal prints "Got from fast queue, in front of $backlog others" o When a backend requests a client of a normal priority request and the client is available, "Service" in Perlbal prints "Backend requesting client, got PRIORITY = $cp-"{fd}.> o When a backend requests a client of a low priority request and the client is available, "Service" in Perlbal prints "Backend requesting client, got low priority = $cp-"{fd}.> o When header are being read, Perlbal::Socket prints "Perlbal::Socket::read_headers($self) is_res=$is_res" Debug level 3 PERLBAL_DEBUG = 3 By setting the debug level to 3 you'll get all the messages from level 1 and 2 plus the following: o Right before response headers are written to the client, Perlbal::BackendHTTP prints " writing response headers to client" o As we're writing to the client, Perlbal::BackendHTTP prints " content_length=VALUE" and " remain=VALUE", where the values are "undef" if they are not defined o If we're done writing to the client, Perlbal::BackendHTTP prints " done. detaching." o Whenever we're determining if we should be sending keep-alive header information back to the client, Perlbal::ClientHTTPBase prints " service's persist_client = $persist_client" o While determining if we should be sending keep-alive header information back to the client, if we were sent "content-length" or it's a head request, as we're doing a keep alive Perlbal::ClientHTTPBase prints " doing keep-alive to client" o If we're not sending keep-alive header information back ot the client, Perlbal::ClientHTTPBase prints " doing connection: close" o Right after we've finished sending all of the results to the user, Perlbal::ClientProxy prints "ClientProxy::backend_finished" o When we've sent a response to a user fully and we need to reset state, Perlbal::ClientProxy prints "ClientProxy::http_response_sent -- resetting state" o When we're writing a response to a client, Perlbal::ClientProxy prints "ClientProxy::event_write" o After writing a response to a client, if it is still connected and we're triggering trigger our backend to keep reading, Perlbal::ClientProxy prints " unstalling backend" o When reading a request, Perlbal::ClientProxy prints "ClientProxy::event_read" o When reading a request and just before we read the headers, Perlbal::ClientProxy prints " no headers. reading." o When reading a request, if we're not buffering to disk or we're no longer reading, as we disable reads, Perlbal::ClientProxy prints " disabling reads." o As we're reading, Perlbal::ClientProxy prints " reading $read_size bytes (VALUE bytes remain)", where "VALUE bytes remain" can be <undef> o After each read, Perlbal::ClientProxy prints " read $len bytes" o After we finished reading the request, Perlbal::ClientProxy prints " done_reading = $done_reading, backend = BACKEND", where "BACKEND" can be "undef" o When we send the headers to the backend and it responds before we're done reading from the client, further reads from the client are discarded; in this situation Perlbal::ClientProxy prints " already responded.". If the client continues to send data, Perlbal::ClientProxy prints " already responded [2]." and then gives up on reading o After reading, and having a backend available where we can write to, just before we do, Perlbal::ClientProxy prints " got a backend. sending write to it." o After reading, if there's no backend available, Perlbal::ClientProxy prints " no backend. read_ahead = $self-"{read_ahead}.> o If we know we've already started spooling a file to disk and we're about to continue doing so, Perlbal::ClientProxy prints " bureason = $self-"{bureason}> o If a backend wasn't available and we're about to request one, Perlbal::ClientProxy prints " finally requesting a backend" o When we're trying to read headers and the client has disconnected, Perlbal::Socket prints " client disconnected" o If we need to remove a trailing " " from the headers, Perlbal::Socket prints " throwing away leading " o If we've read a packet with headers and by the end of it we can't find the end of them, Perlbal::Socket prints " can't find end of headers" o Once we've read some headers, Perlbal::Socket prints " pre-parsed headers: [$hstr]" o After reading headers, if there's additional content that we've read, we push it back; when we do so, Perlbal::Socket prints " pushing back $len bytes after header" o If we got bogus headers, and right before we close the connection due to a parsing failure, Perlbal::Socket prints " bogus headers" o If we got valid headers, Perlbal::Socket prints " got valid headers" o If we're reading buffered data from a client, Perlbal::Socket prints "draining readbuf from $self to $dest: [$$bref]" Debug level 4 By setting the debug level to 4 you get all the messages from levels 1 to 3. Plus, "write" is redefined so that whenever "write" is called it first prints "write($self, <$clen>"$content") from ($pkg, $filename, $line)". PERLBAL_DEBUG = 4 SEE ALSO Perlbal::Manual::Configuration, Perlbal::Manual::Management. perl v5.14.2 2011-01-23 Perlbal::Manual::Debugging(3pm)
All times are GMT -4. The time now is 09:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy