जब मैं SQLite डेटाबेस फ़ाइल खोलता हूं तो फ़ाइल की शुरुआत में बहुत से पठनीय पाठ होते हैं - -B
फ़ाइल परीक्षण के कारण SQLite फ़ाइल को गलत तरीके से फ़िल्टर करने का मौका कितना बड़ा होता है?-बी फ़ाइल परीक्षण कितना विश्वसनीय है?
The -T and -B switches work as follows. The first block or so of the file is
examined for odd characters such as strange control codes or characters with
the high bit set. If too many strange characters (>30%) are found, it's a -B
file; otherwise it's a -T file. Also, any file containing a zero byte in the
first block is considered a binary file.
बेशक
आप अब SQLite फ़ाइलों के एक नंबर का एक आंकड़ा विश्लेषण कर सकता है, उनके "पहले खंड पार्स या:
#!/usr/bin/env perl
use warnings;
use strict;
use 5.10.1;
use File::Find;
my $dir = shift;
my $databases;
find({
wanted => sub {
my $file = $File::Find::name;
return if not -B $file;
return if not -s $file;
return if not -r $file;
say $file;
open my $fh, '<', $file or die "$file: $!";
my $firstline = readline($fh) // '';
close $fh or die $!;
push @$databases, $file if $firstline =~ /\ASQLite\sformat/;
},
no_chdir => 1,
},
$dir);
say scalar @$databases;
मुझे नहीं लगता कि '-T' और' -B' के विवरण दस्तावेज हैं, जिसका अर्थ है कि वे पर्ल की भावी रिलीज में बदल सकते हैं, मुझे लगता है। फिर फिर, इससे उन्हें बेकार बना दिया जाएगा ... इस प्रश्न का एक अच्छा जवाब हेरिस्टिक्स के विवरण का वर्णन करेगा। मैंने हमेशा खुद को – Nemo
पर आश्चर्यचकित किया है, वे perlfunc में दस्तावेज हैं, जहां सभी फाइल ऑपरेटर दस्तावेज हैं। हालांकि, अस्पष्ट अस्पष्ट है। –