I need to extract the t.min and t.max values. The code i have written does not print the value but prints t.min and t.max a 1000 times.MML v2.0; import defaultunit; unit conversion on; math top { t.min = 0; t.max = 3600; t.delta = 5; .........
Please help. Thankyou for all the help. I have to parse the whole file and print to a text file, i have gotten stuck in the first step itself, am kind of worried now. Thanks again.#!usr/bin/perl use strict; use warnings; use Getopt::Long; my $file; GetOptions("f|file=s" => \${file}) or die "invalid option\n"; if ($file) { my $fname = $file; open (INFO,"<",$fname) or die " Could not open\n" ; open (OUTFO,">>","text.txt") or die "Could not open\n"; my (@line, $myline); @line=<INFO>; foreach $myline(@line) { if($myline=~ /(t\.min=)(.*)(;)/) {print OUTFO "tmin = $2\n";}; if($myline=~ /(t\.max=)(.*)(;)/) {print OUTFO "tmax = $2\n";}; } close OUTFO; close INFO; }
In reply to Help : Regular expression by kitty
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |