File hplip-ppd.sh of Package lpdfilter

#!/bin/sh
#
# Parse ppd files of hplip for lpdfilter
#
TAB="$(echo -en '\t')"
for tmp in $(grep -liE "\*ModelName:[ ${TAB}]+\"(HP .*)\"" *.ppd 2> /dev/null) ; do
    if test -e "$tmp" ; then
	model="$(sed -n 's/^\*ModelName:[ ${TAB}]\+\"\([^\"]*\)\"/\1/p' < $tmp)"
	command="$(sed -n "/^\*FoomaticRIPOptionSetting Model=[^:]\+:[ ${TAB}]*\"/,/^\*End/ {
	    s/^\*[^\"]\+\"//
	    :join
	    /\(&&\|^\*End\)\$/{N
		s/\(&&\|^\*End\)\n//
		b join
	    }
	    s/\"$//
	    s/&quot;/\"/gp
	}" < $tmp)"
	echo "$model:$command"
    fi
done
openSUSE Build Service is sponsored by