From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078612210697.tru64-unix-managers.marc@archive.invalid> From: Mike Grau Date: Thu, 29 May 1997 15:23:21 +0000 To: tru64-unix-managers Subject: SUMM: Snagging Files From LPD X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078612210697 Thanks to: Richard Abraham Alan Davis Both suggested good things, but Alan really hit the nail with my head in suggesting replacing the 'if' entry with a shell script that cats the STDIN to a file. In this case I wanted each file received from LPD to get written to it's own individual file rather than overwriting the previous one or appending to it. What seems to work so far is using the lock file to generate part of the file names: NAME=`tail -1 $LOCK | awk -F "x" '{ print $1 }'` cat >>${DIR}${NAME} > lpr file1.txt > lpr file2.txt > lpr file3.txt results in three files and ... > lpr file*.txt results in one file, which is what I wanted. (For now the 'lp' entry is /dev/null) I tried using the .seq file, but 3 "LPR's" in rapid succession would result in the first file received getting written to it's own file and the last two cat'ed together in one file. I also tried using "$$" in the ksh script. Each received file was written to its own file, but a "lpr file[1-3].txt" would also result in three files. Also, of course, the filenames were not meaningful and you could not "cat newfiles* >newerfile" back in the order in which they were received. Original question: Are there some good ways to capture files received by the lpd daemon from the network to individual files on disk rather than having them go to the printer?