get_classlist_info — retrieve information about individuals in the course


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


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.



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


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:

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 module directly.

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2020-12-27 - YiLee
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback