Revision: 22161
                            
                                                            
                                    
                                        
Initial Code
                                    
                                    
                                                            
                                    
                                        
Initial URL
                                    
                                    
                                
                                                            
                                    
                                        
Initial Description
                                    
                                    
                                                            
                                    
                                        
Initial Title
                                    
                                    
                                                            
                                    
                                        
Initial Tags
                                    
                                    
                                                            
                                    
                                        
Initial Language
                                    
                                    
                                                    
                        at January 4, 2010 13:29 by vorp
                            
                            Initial Code
#!/usr/bin/perl
# Usage in command line: perl <app> <file-to-be-converted> <width> <height>
# e.g. <app> myGeo.geo 30 30
# Parse .geo file and reformat as REFRACT-style height data file
my $origfile = $ARGV[0];
my $sizeX = $ARGV[1];
my $sizeY = $ARGV[2];
my $outfile  = "refract_" . $origfile; 
my %hTmp;
 
open (IN, "<$origfile")  or die "Couldn't open input file: $!"; 
#open (OUT, ">$outfile") or die "Couldn't open output file: $!"; 
 
my $numPoints = 0;
my $rowPoints = 0;
my $dataOut = "";
while (my $sLine = <IN>) {
	#print "line\n";
	#if ($sLine =~ m/^([-+]?([0-9]*\.)?[0-9]+)  ([-+]?([0-9]*\.)?[0-9]+) ([-+]?([0-9]*\.)?[0-9]+) [-+]?([0-9]*\.)?[0-9]+/) {
	if ($sLine =~ m/^([-+]?[0-9]*\.?[0-9]+)\s+([-+]?[0-9]*\.?[0-9]+)\s+([-+]?[0-9]*\.?[0-9]+)\s+([-+]?[0-9]*\.?[0-9]+)\s+$/ )  {
		my $x = $1;
		my $y = $2;
		my $z = $3;
		my $myString = sprintf("%.4f", $y);
		$dataOut .= "$myString ";
		$rowPoints++;
		if ($rowPoints >= $sizeX) {
			$dataOut .= "\n";
			$rowPoints = 0;
		}
		$numPoints++;
	}
}
#close OUT;
close IN;
#print "Num points: $numPoints \n";
print $dataOut;
                                Initial URL
Initial Description
Scans a file for a series of floating point numbers separated by spaces.
Initial Title
Scan file for Floating point numbers with regex
Initial Tags
regex, file
Initial Language
Perl