diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2015-01-21 16:06:33 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2015-01-21 16:06:33 -0500 |
commit | c3785203eac0c76cc474dfe0fee2e83650d376b2 (patch) | |
tree | 8be794756d2036d80a763a20b73334b023a08812 /banner2csv.pl | |
parent | 7879e98f56037b6bea1585bebc043e9f7f1056a1 (diff) | |
download | GradeBook-c3785203eac0c76cc474dfe0fee2e83650d376b2.tar.gz GradeBook-c3785203eac0c76cc474dfe0fee2e83650d376b2.zip |
banner2csv.pl: added CRN detection capability
Diffstat (limited to 'banner2csv.pl')
-rwxr-xr-x | banner2csv.pl | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/banner2csv.pl b/banner2csv.pl index 7c5ef7b..31dccc1 100755 --- a/banner2csv.pl +++ b/banner2csv.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # FILE: "/home/evmik/src/my_src/GradeBook/banner2csv.pl" -# LAST MODIFICATION: "Fri, 29 Aug 2014 17:36:54 -0400 (evmik)" +# LAST MODIFICATION: "Wed, 21 Jan 2015 16:06:08 -0500 (evmik)" # (C) 2012 by Eugeniy Mikhailov, <evgmik@gmail.com> #use HTML::Entities; @@ -13,14 +13,14 @@ use Data::Dumper; if ( @ARGV < 1 ) { - print "Converts a WM banner summary list to csv file with students info\n"; - print "\n"; - print "Usage:\n"; - print " " . $0 . " banner_html_file_to_parse\n"; - print "\n"; - print "Example:\n"; - print " " . $0 . " banner_class_summary_list.html\n"; - die; +print "Converts a WM banner summary list to csv file with students info\n"; +print "\n"; +print "Usage:\n"; +print " " . $0 . " banner_html_file_to_parse\n"; +print "\n"; +print "Example:\n"; +print " " . $0 . " banner_class_summary_list.html\n"; +die; } my $html_file = shift; @@ -29,6 +29,26 @@ open (F_HTML, "<", $html_file) or die "Failed to read file $html_file : $!"; my @fcontent = <F_HTML>; $html_string=join('', @fcontent); +# lets find CRN, i.e. section number +my $flag_crn_located = 0; +foreach $ln (@fcontent) { +if ($flag_crn_located == 1) { + $crn_str = $ln; + last; +} +if ($ln =~ /CRN:/) { + $flag_crn_located = 1; +} +} +#print "crn string ".$crn_str; +my $section = "unknown"; +if ( $crn_str =~ m{>(\d+)<} ) { + $section = $1; +} else { + $section = "unknown"; +} +#print "section: ".$section."\n"; + # this look for the table based on its headers my $te = HTML::TableExtract->new( @@ -134,9 +154,6 @@ foreach $row ($te->rows) { $email = $href; $email =~ s/mailto://; - # section - $section = "unknown"; - print join(',', $sid, $fname, $lname, $section, $email); print "\n"; } |