in reply to Re: Comparing 2 files!!
in thread Comparing 2 files!!

The main purpose is to compare two files and match the contents of one file in order to get the line number of that match!

One of the files has code comments! And the other has the source code from where the comments where extracted!

Example:
File1.txt
public class Finger { //Commment 1 public static void main(String[] arguments) {//com 2 String user; String host; //comm3

File2.txt
//Comment 1 //com 2 //comm3
Result
Line 1: //Comment 1 Line 2: //Com 2 Line 5: //comm3

Thank you all for your help!!

Replies are listed 'Best First'.
Re: Re: Re: Comparing 2 files!!
by Thelonius (Priest) on Jul 14, 2003 at 16:45 UTC
    If you have grep on your system, this would work:
    grep -F -n -f File2.txt File1.txt