vivapl has asked for the wisdom of the Perl Monks concerning the following question:
Is there a way of detecting whether a file is of binary type before opening it?
My script receives a text file with a list of files that need to be processed, however sometimes they're binary.
Any hints would be greatly appreciated.
Thanks...
Ok, to be more specific, a seperate process collects logs from computerized machines.
The logs are in text format, however every so often the logs contain 'garbage'(this is a bug in the machine's OS).
When using the conventional 'grep' to search for a string, it reports back as a binary file.
Since my script is part of an automized process, I need a way to discard such logs containing garbage.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Some binary wisdom needed
by Roy Johnson (Monsignor) on May 28, 2004 at 15:05 UTC | |
|
Re: Some binary wisdom needed
by calin (Deacon) on May 28, 2004 at 15:15 UTC | |
|
Re: Some binary wisdom needed
by BrowserUk (Patriarch) on May 28, 2004 at 14:38 UTC | |
|
Re: Some binary wisdom needed
by Anonymous Monk on May 28, 2004 at 14:41 UTC | |
|
Re: Some binary wisdom needed
by EdwardG (Vicar) on May 28, 2004 at 14:56 UTC | |
|
Re: Some binary wisdom needed
by vivapl (Acolyte) on May 28, 2004 at 16:27 UTC | |
by Anonymous Monk on May 30, 2004 at 11:37 UTC |