Newsgroups: comp.lang.perl.moderated
From: Mazin07 <mazi...@gmail.com>
Date: Sat, 24 Sep 2005 01:06:26 GMT
Local: Fri, Sep 23 2005 9:06 pm
Subject: Fast Linear Hex Search
I need a Perl script to search through a file to find specific hex
strings, NOT ASCII. Ideally, it should not read more of the file than it needs, and to quit when it does find it. The file is about 4 mb, with 8 million hex digits. How should I go about doing this in perl? Obviously I don't want to If anybody's interested, it is 8 million digits of pi, in hex form (2 There's a slow PHP version if you care. http://ericjiang.co.nr/pi.php You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.perl.moderated
From: Jeff Schwab <jeffrey.sch...@rcn.com>
Date: Sat, 24 Sep 2005 09:45:24 -0400
Local: Sat, Sep 24 2005 9:45 am
Subject: Re: Fast Linear Hex Search
Mazin07 wrote: What do you mean "in hex form?" Do you just mean that each 4-bit nybble > I need a Perl script to search through a file to find specific hex > strings, NOT ASCII. Ideally, it should not read more of the file than > it needs, and to quit when it does find it. The file is about 4 mb, with > 8 million hex digits. > How should I go about doing this in perl? Obviously I don't want to > If anybody's interested, it is 8 million digits of pi, in hex form (2 > There's a slow PHP version if you care. http://ericjiang.co.nr/pi.php represents an unsigned integer from 0 to 15? You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.perl.moderated
From: jerry davis <jfd...@wi.rr.com>
Date: Sat, 24 Sep 2005 09:41:16 -0500
Local: Sat, Sep 24 2005 10:41 am
Subject: Re: Fast Linear Hex Search
On Friday 23 September 2005 08:06 pm, Mazin07 wrote:
> I need a Perl script to search through a file to find specific hex look at the functions sysopen and sysread > strings, NOT ASCII. Ideally, it should not read more of the file than > it needs, and to quit when it does find it. The file is about 4 mb, with > 8 million hex digits. > How should I go about doing this in perl? Obviously I don't want to this will do the trick. on sysread you can specify how many bytes to read. > If anybody's interested, it is 8 million digits of pi, in hex form (2 digits of pi. > There's a slow PHP version if you care. http://ericjiang.co.nr/pi.php Registered Linux User: 275424 Today's Fortune: The only constant is change. You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.perl.moderated
From: Ilya Zakharevich <nospam-ab...@ilyaz.org>
Date: Sat, 24 Sep 2005 21:43:33 +0000 (UTC)
Local: Sat, Sep 24 2005 5:43 pm
Subject: Re: Fast Linear Hex Search
[A complimentary Cc of this posting was sent to
jerry davis <jfd...@wi.rr.com>], who wrote in article <200509240941.16311.jfd...@wi.rr.com>: > > If anybody's interested, it is 8 million digits of pi, in hex form (2 perl -MMath::Pari=:prec=10000,Pi -wle "print Pi" > > digits per byte). I already converted from ASCII into that packed > > format, but now I need to search it. > this sounds cool, I bought a book on pi, from B&N, and it had I think 10000 AFAIK, the algorithm takes O(n^3/2). To get a million of digits may Hope this helps, You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.perl.moderated
From: Mazin07 <mazi...@gmail.com>
Date: Sat, 24 Sep 2005 19:25:28 GMT
Local: Sat, Sep 24 2005 3:25 pm
Subject: Re: Fast Linear Hex Search
jerry davis wrote: I'm not too sure on the best way to go about searching it. With > On Friday 23 September 2005 08:06 pm, Mazin07 wrote: >>I need a Perl script to search through a file to find specific hex >>How should I go about doing this in perl? Obviously I don't want to > look at the functions sysopen and sysread sysopen, would I have to incrementally read more bytes? That would mean looping over a lot - how would it affect the run speed? How do I get it to give me hex instead of ascii? I don't want to continually convert ascii to hex. You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.perl.moderated
From: Keith Thompson <ks...@mib.org>
Date: Mon, 26 Sep 2005 00:31:36 GMT
Local: Sun, Sep 25 2005 8:31 pm
Subject: Re: Fast Linear Hex Search
Mazin07 <mazi...@gmail.com> writes: If it's 2 digits per byte, it's not in hex form. Hexadecimal is a > I need a Perl script to search through a file to find specific hex > strings, NOT ASCII. Ideally, it should not read more of the file > than it needs, and to quit when it does find it. The file is about 4 > mb, with 8 million hex digits. > How should I go about doing this in perl? Obviously I don't want to > If anybody's interested, it is 8 million digits of pi, in hex form (2 (typically ASCII) text representation of base-16 numbers, using the characters '0'..'9', 'a'..'f'. It typically takes 8 bits per hexadecimal digit. The format you're describing sounds like plain binary. Or is it If it's binary-coded decimal, it's going to look something like this: 0011 0001 0100 0001 0101 1001 ... -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.perl.moderated
From: Mazin07 <mazi...@gmail.com>
Date: Mon, 26 Sep 2005 23:01:41 GMT
Local: Mon, Sep 26 2005 7:01 pm
Subject: Re: Fast Linear Hex Search
Binary-coded decimal actually. I was referring to it like that because
the digits 1 and 2 would show as 12 in hex. so.. (3.) 14159265 would be 14 15 92 65 So what's the best function to search for strings of numbers in that, Or would it be better to just expand the whole thing into human-readable You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.perl.moderated
From: Yitzchak Scott-Thoennes <sthoe...@efn.org>
Date: Tue, 27 Sep 2005 03:43:56 -0700
Local: Tues, Sep 27 2005 6:43 am
Subject: Re: Fast Linear Hex Search
If you mean you want to search for a string of digits like 14159265
and there may be an odd number of digits, or you want to find them whether they start at an odd or even position, you have enormously complicated things by packing your data that way. You could come up with a regex that would work, but it's much less trouble just to have your file not packed. You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.perl.moderated
From: Ilya Zakharevich <nospam-ab...@ilyaz.org>
Date: Tue, 27 Sep 2005 21:19:44 +0000 (UTC)
Local: Tues, Sep 27 2005 5:19 pm
Subject: Re: Fast Linear Hex Search
[A complimentary Cc of this posting was sent to
Yitzchak Scott-Thoennes <sthoe...@efn.org>], who wrote in article <20050927104356.GA3...@efn.org>: > If you mean you want to search for a string of digits like 14159265 "Enormously"??? I doubt it. Fixed strings are easy: > and there may be an odd number of digits, or you want to find them > whether they start at an odd or even position, you have enormously > complicated things by packing your data that way. /\x14\x15\x92\x65/ || /[\x01...\xF1]\x41\x59\x26[\x50-\x5F]/ (of course, this leading [\x01...\xF1] should be completely spelled out). What *is* enormously complicated is looking for regular expressions in Hope this helps, You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.perl.moderated
From: Yitzchak Scott-Thoennes <sthoe...@efn.org>
Date: Tue, 27 Sep 2005 16:50:51 -0700
Local: Tues, Sep 27 2005 7:50 pm
Subject: Re: Fast Linear Hex Search
mailed and posted
I didn't mean to imply that it was objectively difficult, just that it increases the complexity of a solution by a factor of 3 or more. Just a routine to compute the regex to use for a given series of digits You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
| Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy |
| ©2013 Google |