I built a little shell script to handle the inserting of trigger codes to an ascii print file...basically I have a file with the codes I need at the top of the print file and at the bottom, I cat them all together with the current print data and send to another print queue. It works well...
Now I want to actually insert codes into the middle of the file...ie: I want to goto line 2 and insert some stuff into the begining of that line, or I want to search for a paticular word and insert stuff there...I need help...I'd like to do this all as variables (I mean I don't want to write an acutal data file, unless you can tell me how to create a filename that is random so that if this script is being run by multiple users it won't overwrite..
My current script..
#!/bin/sh
QUEUE=printerqueue
HEADER=/usr/local/lib/header.file
TRAILER=/usr/local/lib/trailer.file
options$5
shift 5
for FILE in $*
do
cat $HEADER $FILE $TRAILER | lp -d $QUEUE
done
exit 0
Thoughts...Any help would be appreciated...
Doug.