I am looking to collect yang models from my project .jar files.Though i came with an approach but it takes time and my colleagues are not happy.
#!/bin/sh
set -e
# FIXME: make this tuneable
OUTPUT="yang models"
INPUT="."
JARS=`find $INPUT/system/org/linters -type f -name '*.jar' | sort -u`
# FIXME: also wipe output?
[ -d "$OUTPUT" ] || mkdir "$OUTPUT"
for jar in $JARS; do
    artifact=`basename $jar | sed 's/.jar$//'`
    echo "Extracting modules from $artifact"
    # FIXME: better control over unzip errors
    unzip -q "$jar" 'META-INF/yang/*' -d "$artifact" \
        2>/dev/null || true
    dir="$artifact/META-INF/yang"
    if [ -d "$dir" ]; then
        for file in `find $dir -type f -name '*.yang'`; do
            module=`basename "$file"`
            echo -e "\t$module"
            # FIXME: better duplicate detection
            mv -n "$file" "$OUTPUT"
        done
    fi
    rm -rf "$artifact"
done
 
    