#!/bin/bash schemasurl='http://schemas.dmtf.org/wbem/cim-html/2.31.0/' usage() { printf "$0 usage:\n" printf "$0 file\n" printf "$0 will read file and show which classes are defined in mof file " printf "and print in pretty format usable easy in wiki\n" } die() { printf "%s\n" "$@" exit 1 } >&2 (( $# > 0 )) || die "Invalid number of parameters" if [[ "$1" == "-h" || "$1" == "--help" ]]; then usage exit 0 fi moffile="$1" [[ -r "$moffile" ]] || die "$moffile is not readable" export LC_ALL=C printf "||= Defined class name =||= Inherited from =||\n" while IFS= read line; do if [[ $line =~ ^class[[:blank:]]*([[:alnum:]_]*)":"[[:blank:]]*([[:alnum:]_]*) ]]; then newclass=${BASH_REMATCH[1]} derived=${BASH_REMATCH[2]} printf "|| [wiki:%s %s] || [$schemasurl%s.html %s] ||\n" "$newclass" "$newclass" "$derived" "$derived" fi done < "$moffile"