Users/KenBloom/OCL

InfoInfo
Search:    

These are some scripts to make searching the open course list easy. They're written by Ken Bloom and they're in the public domain.

updatecourses

Downloads the current copy of the course list.

#! /bin/tcsh
lynx -dump -dont-wrap-pre http://registrar.ucdavis.edu/ocl/opencourses.html > opencourses.txt

findclass

Finds classes by course number, when the numbers are given like "LIN 001", "MAT 016A", or simply given the 3-letter department code, it can display a whole department.

For example  findclass 'MAT 016A'  or  findclass MAT  or  findclass 'MAT 1..' . (That last one finds all upper division courses in the math department.

#!/usr/bin/perl
$FILE="opencourses.txt";
open(FILE);
@lines=<FILE>;
close(FILE);
$findstat=0;
foreach $line (@lines) {
        if ( $findstat == 0 && $line =~ /^[0-9 ^]+$ARGV[0]/){
                $findstat=1;
        }
        if ($findstat == 1 && $line !~ /^ / &&  $line !~ /^[0-9 ]+$ARGV[0]/){
                exit;
        }
        if ($findstat == 1){
                print "$line";
        }
}

checkcrn

Checks the number of spaces left in the given course sections.

For example  checkcrn 89483 58372 90929 

#!/usr/bin/perl
$FILE="opencourses.txt";
open(FILE);
@lines=<FILE>;
close(FILE);
CRN: foreach $crn (@ARGV){
        $findstat=0;
        foreach $line (@lines) {
                if ( $findstat == 0 && $line =~ /^\Q$crn\E/){
                        $findstat=1;
                }
                elsif ($findstat == 1 && $line !~ /^ /){
                        next CRN;
                }
                if ($findstat == 1){
                        print "$line";
                }
        }
}
This is a Wiki Spot wiki. Wiki Spot is a 501(c)3 non-profit organization that helps communities collaborate via wikis.