Operating System - HP-UX
1745857 Members
4164 Online
108723 Solutions
New Discussion

prinintg a file with date variable

 
SOLVED
Go to solution
DeafFrog
Valued Contributor

prinintg a file with date variable

Dear Gurus,

a small script , which look likes this :

case ~~

cd $BSSREPT;for i in `cat /home/mango/Reports/finance`;do;lp -d"$PRINTER_NAME" $i;done;;

the problem is :

$ more finance
132_DFO1001_Date_DEP.001.rpt
132_DFO1002_Date_DET.001.rpt
132_DFO1004_Date_DET_C.001.rpt
132_DFO1004_Date_SUM_C.001.rpt
132_DFO1004_DET_Date_C.001.rpt
~
since the file to be printed containd a date component which will vary everyday .....how can i have them print in my script ..hope i am clear ....Regards,
Rahul


FrogIsDeaf
1 REPLY 1
James R. Ferguson
Acclaimed Contributor
Solution

Re: prinintg a file with date variable

Hi:

> since the file to be printed containd a date component which will vary everyday

I assume that you mean your file is really a template of names where "_Date_" should be substituted with the current values. If so, you could do something like:

...
for i in `sed -e "s/_Date_/_$(date +%Y%m%d)_/" finance`; do
...

(or better):

...
for i in $(sed -e "s/_Date_/_$(date +%Y%m%d)_/" finance); do
...

Regards!

...JRF...