Name

get_classlist_info — retrieve information about individuals in the course

Synopsis

get_classlist_info [-r] [-t term] {src_field_name} {src_field_value} {outfield...}

Description

This command is designed to read information from the classlist; it is a command-line wrapper for some of the functionality of the Classlist perl module.

Options

-t term

Use the information for a specific term, given in MFCF format; defaults to the current term. This can be '*' to read all terms.

-r

Specifies that src_field_value is to be interpreted as a regular expression.

Usage

This command requires at least three parameters: the field to use as a key, the value to search for in that field, and at least one destination field to output. Additional fields may be specified. These fields will then be printed to standard output, colon-delimited, with one classlist entry per line.

This utility automatically reads in the classlist, exceptionlist, and coursestaff files for the current term to reduce command-line bloat and automatically allow a variety of manipulation of the current term. For example, to get a list of userids of all students taught by d3prof (using bash):

for lec in $(get_classlist_info userid d3prof lecture | tr , "\n"); do
   get_classlist_info lecture "$lec" type userid | grep '^student' | cut -f2 -d:
done
      

Note that get_classlist_info is designed to be simple and can only filter based on a single criterion. To do more manipulation, it is necessary either to invoke external commands (as with grep in the above example) or to use the Classlist.pm module directly.

Topic revision: r1 - 2016-01-11 - YiLee
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback