Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pattern matching

Status
Not open for further replies.

broloc

Programmer
Jun 10, 2002
27
JP
Hi all,
i got problem about pattern matching.Could u all please give me some idea how i can do pattern macthing between 2 file.
ok this is the scenario..
i got file A and file B.File A is existing data and File B is a downloadable data.What i'm going to do is i want to update file A using file B.This is my coding.i think there are a lot of mistake.I'm glad if u all could give me an idea or an advice.tq

open (INPUT, "customize_rule.txt") || die "can't open file";
#my @Rule = <INPUT>;

$pattern = 'IDS\d{2,3}';

while (<INPUT>)
{

if (/$pattern/)
{
$t = $_;
#print &quot;$t\n&quot;;
#print &quot;$1\n&quot;;
open (OUT, &quot;existcustomize.txt&quot;) || die &quot;can't open file&quot;;
while (<OUT>)
{
if ($t ne $_)
{
open (CUSTOMIZE, &quot;>>existcustomize.txt&quot;) || die &quot;can't open file&quot;;
print CUSTOMIZE $t;
print &quot;$t\n&quot;;
last;

}
else
{
print &quot;rule already exist\n&quot;;
last;
}
}

}

}
print &quot;\n\n&quot;;
close(INPUT);
close(OUT);
close(CUSTOMIZE);

 
How do you need to &quot;update&quot; the new file? Need examples of the data to create a pattern to match it. ----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
opss sorry i forgot..ok the data looks like this
alert TCP $external any->$internal any (msg: &quot;ISD282/shellcode....)

i just want to update the data according to the IDS num.if the IDS num for example 'IDS282' not exist in the file A so it will take sentence IDS282 and copy it to file B.

it that clear 4 u...
i really hope that u can help me...:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top