#! /bin/sh prefix="syscfg addbyte" file=cl.txt if [[ $# -gt 2 ]]; then echo "Incorrect argument" elif [[ $# -eq 2 ]]; then file=${2}.txt fi if [[ ! -f $1 ]]; then echo "File not exists" exit fi func() { p="$(echo $prefix $1)" if [ $1 == "BLCl" ]; then echo "$(grep "${prefix} $1" "$2" | tail -n1 | tr -s '[:space:]' | rev | cut -d ' ' -f 1 | rev) insight color cal $1" >> $file else echo "$(grep "${prefix} $1" "$2" | head -n1 | tr -s '[:space:]' | rev | cut -d ' ' -f 1 | rev) insight pre color cal $1" >> $file echo "$(grep "${prefix} $1" "$2" | tail -n1 | tr -s '[:space:]' | rev | cut -d ' ' -f 1 | rev) insight post color cal $1" >> $file fi # echo "0x$(sysconfig read -k $1 | tr -d '[:space:]' | rev | cut -d '|' -f 1 | rev) System $1" >> $file echo "" >> $file } func "BLCl" "$1" func "GLCl" "$1" func "DPCl" "$1"