CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
pattern mathc in .jar file

 



sandeepsirsgi
Novice

Jan 22, 2007, 4:32 AM

Post #1 of 10 (8811 views)
pattern mathc in .jar file Can't Post

Hi,

I have two files A and B.
I want a script which should match file A content in B, then find the equivalent value in file B, then find these files in ex.jar file. create a new .jar file which should contain only the pattern matched files.
At the end it should search com.file.dius.n.d and com.file.dius.n.e in the ex.jar file and create a new .jar which should contain only the matched files.
Please can any one help me.

Content of file A
com.file.dius.lc.ManagerIntf
com.file.dius.lc.Modules

Content of file B
com.file.dius.dbpool.Exception => com.file.dius.f.b
com.file.dius.dbpool.DbConnectionPool => com.file.dius.f.d
com.file.dius.exception.MediusAppException => com.file.dius.r.a
com.file.dius.filter.FilterException => com.file.dius.c.b
abstract com.file.dius.filter.MediusFilter => com.file.dius.c.c
com.file.dius.lc.LicenseChecker => com.file.dius.n.b
com.file.dius.lc.LicenseManager => com.file.dius.n.c
com.file.dius.lc.LicenseManagerException => com.file.dius.n.a
abstract com.file.dius.lc.ManagerIntf => com.file.dius.n.d
com.file.dius.lc.Modules => com.file.dius.n.e
com.file.dius.logger.Log => com.file.dius.i.a
abstract com.file.dius.logger.CategoryIntf => com.file.dius.i.b
com.file.dius.logger.LogFactory => com.file.dius.i.c
com.file.dius.mail.LogFileMailer NameNotChanged
com.file.dius.mail.PostOffice NameNotChanged


Regards
sirsgi
Attachments: A.txt (56 B)
  B.txt (1.00 KB)


KevinR
Veteran


Jan 22, 2007, 10:58 AM

Post #2 of 10 (8805 views)
Re: [sandeepsirsgi] pattern mathc in .jar file [In reply to] Can't Post

Have you written any code? Are you hung up on a particular task
-------------------------------------------------


sandeepsirsgi
Novice

Jan 22, 2007, 9:43 PM

Post #3 of 10 (8798 views)
Re: [KevinR] pattern mathc in .jar file [In reply to] Can't Post

This is the code i had .

#!/usr/bin/perl
use strict;
use warnings;
open (FILE3,"A") || die "can't open the file filename : $!\n";
open (FILE4,"B") || die "can't open the file : $!\n";
open (FILE5,">>list") || die "can't create file list : $! \n";
while(<FILE3>)
{
chomp;
print("$_ content of file list \n");
chomp;
while(my $test1 = <FILE4>)
{
chomp;
print "$test1 \n";
if($test1 =~m /$_/)
{
print "Matched line is $test1 \n ";
}

}
}


close(FILE4);
close(FILE3);
close(FILE5);


This code is printing only the first matched line from file A and B, not all. At present i have only this much of code. Any sugesstion to implement the whole requirement are welcome.


(This post was edited by sandeepsirsgi on Jan 22, 2007, 9:43 PM)


KevinR
Veteran


Jan 23, 2007, 10:28 AM

Post #4 of 10 (8783 views)
Re: [sandeepsirsgi] pattern mathc in .jar file [In reply to] Can't Post

what should the matches be between those two files?
-------------------------------------------------


sandeepsirsgi
Novice

Jan 23, 2007, 9:36 PM

Post #5 of 10 (8780 views)
Re: [KevinR] pattern mathc in .jar file [In reply to] Can't Post

It should match content of file A in B then write the result to STDOUTPUT.


KevinR
Veteran


Jan 23, 2007, 10:40 PM

Post #6 of 10 (8777 views)
Re: [sandeepsirsgi] pattern mathc in .jar file [In reply to] Can't Post

Sorry, I meant I would like for you to show me exactly and specifically what you think should match between the two files you posted.
-------------------------------------------------


sandeepsirsgi
Novice

Jan 23, 2007, 11:28 PM

Post #7 of 10 (8775 views)
Re: [KevinR] pattern mathc in .jar file [In reply to] Can't Post

I found that what mistake i was doing.


KevinR
Veteran


Jan 23, 2007, 11:39 PM

Post #8 of 10 (8774 views)
Re: [sandeepsirsgi] pattern mathc in .jar file [In reply to] Can't Post

OK, then you no longer need help?
-------------------------------------------------


sandeepsirsgi
Novice

Jan 24, 2007, 12:53 AM

Post #9 of 10 (8772 views)
Re: [KevinR] pattern mathc in .jar file [In reply to] Can't Post

still i need help.

slightly change in requirement.

I had a file C and a ex.jar file.

content of file C is

com/oot/dius/n/d
com/oot/dius/n/e


I want a script which should find content of fille C in ex.jar, then create a new .jar file which should contain only the files that are found.

At the end it should search com/file/dius/n/d and com/file/dius/n/e in the ex.jar file and create a new .jar which should contain only the matched files.
At present i had no code.


KevinR
Veteran


Jan 24, 2007, 10:38 AM

Post #10 of 10 (8770 views)
Re: [sandeepsirsgi] pattern mathc in .jar file [In reply to] Can't Post

I will help you with your existing code or with links to resources but I will not write your code for you.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives