Need help with awk - how to read a content of a file from every file from file list

Hi Experts.

I need to list the file and the filename comes from the file ListOfFile.txt.
Basicly I have a filename "ListOfFile.txt" and it contain
Example of ListOfFile.txt
/home/Dave/Program/Tran1.P
/home/Dave/Program/Tran2.P
/home/Dave/Program/Tran3.P
/home/Dave/Program/Tran4.P
/home/Dave/Program/Tran5.P

Each file contain the same format on the first 2 lines about it's version.
I need to read the data from thesecond line column 3
Example of Tran1.P
/****************************
01122008 /home/Dave/Program/Tran1.P 10.05
****************************/
After I get the data from second line column 3 (10.05), I need to compare this data to the same filename that I found from file mapVersion.txt
Example of mapVersion.txt
Tran001.P|3.4
Tran020.P|4.2
Tran1.P|10.05
Tran12.P|4.11
Tran2.P|3.0
Tran3.P|10.5
Tran3A.P|12.3
Tran4.P|4.1
Tran5.P|1.2

I want to know if it's the same or not.

I know how to write script with ksh but I like to use awk to do this because I think it's faster than while loop.

Thanks in advance,
Tanit

Anyone can help with this? or do you know the command that may lead to pull data from a file which in a file?

Please don't 'bump-up' posts - it's against the rules.

The same as what?

Why?

Yes, we must ask you to be patient.

Try this (use nawk or /usr/xpg4/bin/awk on Solaris):

awk -F\| 'FILENAME == ARGV[1] { 
  m[$1] = $2; next
  }
FILENAME == ARGV[2] { 
  n = split($0, t, "/"); f[$0] = t[n]
  ARGV[ARGC++] = $0; next
  }
{ 
  FNR == 1 && FS = "[ \t]*"  
  if (FNR == 2) 
  print FILENAME ": version", ($NF == m[f[FILENAME]] ? \
  "OK" : "mismatch " $NF " <-> " m[f[FILENAME]])
  }' mapVersion.txt ListOfFile.txt

Thank you very much Radoulov.

I am looking into the code now =)

Notice that if the input files are large and you have GNU awk, including nextfile after the print statement in the if block (you should add another pair of braces too) will significantly improve the performance of the script.

#!/usr/bin/perl
open FH,"<mapVersion.txt";
while(<FH>){
	chomp;
	my @tmp=split("[|]",$_);
	$hash{$tmp[0]}=$tmp[1];
}
close FH;
# above put <mapVersion.txt> content into a hash
open FH,"<ListOfFile.txt";
while(<FH>){
	chomp;
	if (not exists $hash{$_}){
		print "No need to check $_\n";
		next;
	}
	else{
		open TFH,"c.sh $_|";  #c.sh is just get our desired value of certain file's second line		my $tmp=<TFH>;
		if ($tmp != $hash{$_}){
			print "Not match for $_ [$hash{$_} -- $tmp]\n";
		}
		else{
			print "Match for $_\n";
		}
		close TFH;
	}
}