starface245 has asked for the wisdom of the Perl Monks concerning the following question:
It has to be in hex string format. Thanks!#!/usr/bin/perl use strict; my @files =glob ("*.txt"); my $hex_out = "hex.txt"; for my $file(@files) { open (HEX_IN, "$file") or die; open (HEX_OUT, ">$hex_out") or die; binmode(HEX_IN); binmode(HEX_OUT); local $/; my $hex_string = <HEX_IN>; if ($hex_string =~ /\hello/) { print HEX_OUT "$file"; print HEX_OUT " match"; } else { print HEX_OUT "$file"; print HEX_OUT " not match"; } } close(HEX_IN); close(HEX_OUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hex string search all files in directory
by LanX (Saint) on Dec 03, 2012 at 21:03 UTC | |
|
Re: Hex string search all files in directory
by bdalzell (Sexton) on Dec 03, 2012 at 21:22 UTC | |
by choroba (Cardinal) on Dec 04, 2012 at 09:17 UTC |