in reply to Re: compare data between two files using Perl
in thread compare data between two files using Perl
prints results:#This program will return the refdes, part number and package type #tab delimeted for each instance from brd_sym_pn.txt (extracted from #a layout database) and part number and package type from sym_tezt_lat +est.txt #generated from sym_text_mmddyy.xls when part number is entered at <ST +DIN> prompt #Compares the pkg_type used on board with sym_text log files and repor +ts #whether the pkg_type is correct or reports what the correct pkg_type +should be. $Pnum = "12-0259-01"; print $Pnum; open(partlog, "sym_text_latest.txt") || die("failed to open sym_ +text_latest.txt"); while($line = <partlog>) { @fields = split(/\t/,$line); if($fields[0] eq $Pnum) { our $LogPnPkg = "$fields[0]\t$fields[4]"; our $LogPnum = "$fields[0]"; our $LogPkg_Type = "$fields[4]"; } } open(brdpartlog, "brd_sym_pn.txt") || die("failed to open brd_s +ym_pn.txt"); print "\n"; open(brdpartlog, "brd_sym_pn.txt") || die("failed to open br +d_sym_pn.txt"); print "\n"; while($line = <brdpartlog>) { @fields = split(/\t/,$line); if($fields[1] eq $Pnum) { our $RdesPnPkg = "$fields[0]\t$fields[1]\t$fields[2] +"; our $BrdPnPkg = "$fields[1]\t$fields[2]"; our $RefDes = "$fields[0]"; if($BrdPnPkg eq $LogPnPkg) { print("$RefDes\t$BrdPnPkg is the correct Allegro footp +rint.\n"); } else { print("$RefDes\t$BrdPnPkg should be using $LogPkg_Type +\n"); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: compare data between two files using Perl
by pc88mxer (Vicar) on Jun 18, 2008 at 21:19 UTC |