Thanks to Toby and Scott for their help!

I would like share this script in hopes that it might benefit another
"bash impaired" person.

The output from scs2ascii is piped into this script. The users name in
the document file is determined by grep. The file is piped into
enscript where it is formatted the way that I want it. It is then piped
into ps2pdf and output as a pdf file with the name of the user that was
determined by grep. The date and time is also appended to the filename.

Toby, I chose not to use the colon in the time section as it causes
problems with filenames. I'm sure that was just an oversight on your
part. Instead of another "-", I just used the military time format.

Thanks again, both of you, for your kindness and assistance. You made
my project go much faster than I expected!! ;-)


Sincere regards,
Mitch Martin


#! /bin/bash

file=`cat /dev/stdin`
users="PHILLIP SAM RICHARD"

for user in $users; do
echo "$file" | grep $user >/dev/null && echo \
"$file" | enscript -Bc -f Courier9 -p - | ps2pdf - > \
/home/misadmin/"$user"_`date +%Y-%m-%d_%H%M`.pdf && break
done

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].