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: Need a Custom or Prewritten Perl Program?: I need a program that...: Re: [BillKSmith] Help me code this logic please: Edit Log



AwsedreswA
New User

Jan 5, 2014, 6:16 AM


Views: 17167
Re: [BillKSmith] Help me code this logic please

Here is where I am at now.

It'd be nice to have progress indicator.

It would also be nice to do more than just one coordinate at a time since I have to wait forever to read off a USB 2.0 HDD. Im guessing this is hard and would require array work.

Code
$out_file="C:\\perl\\scripts\\bluetime.txt";	# out_file is the output file name 
#$out_file="C:\\perl\\scripts\\bluetime.txt"; # uncomment and put your source here!!!!
unlink $out_file; # erased (deletes) the output file FIRST,
# otherwise it will continue to append to it!

open ($output_file,">>",$out_file) or die "Could not open output_file!!!"; #open file for append

for ($i=1;$i<=60075;$i++) # files 00000.txt thru 60075.txt
{
$output_name = sprintf("%05d",$i); # first field in bluetime, 5 digits

$input_file = sprintf("G:\\Frames_as_RGB_Tuples\\%05d.txt",$i); # FQ input filename
# $input_file = sprintf("C:\\perl\\scripts\\%05d.txt",$i);

open ($infile, "<",$input_file) or die "Could not open input file $input_file!!!";

## "<" means read from, ">>" means append to, ">" means write to!

# printf("G:\\Frames_as_RGB_Tuples\\%s.txt\n", $result);

while(<$infile>) # read one line from infile, put in $_
{
if($_ =~ /^390\t379/)
{
# print $_;
# print sprintf("%s\t-->%s<--\n",$output_name,$_);
print $output_file sprintf("%s\t%s",$output_name,$_); #5 digits plus tuple
}
}

close $infile;

}

close $output_file;



(This post was edited by AwsedreswA on Jan 5, 2014, 6:16 AM)


Edit Log:
Post edited by AwsedreswA (New User) on Jan 5, 2014, 6:16 AM


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

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