A simple file IO program in Perl
This program searches the instructions.txt file line by line to and print the lines immediately after the ones matching the Patter /Read.*RegAddr:\ 0×3/.
#!/usr/bin/perl
open INSTR_FILE, "< Instructions.txt" or die "Cannot open instruciton file $!";
print "## Register 3n";
while ($line = <INSTR_FILE>){
if ($line =~ /Read.*RegAddr: 0x3/){
$line = <INSTR_FILE>;
@fields = split /t/,$line;
print $fields[2],"n";
}
}
close INSTR_FILE;