#!/usr/bin/ksh
# This script reads the *.rpt files created by xenos during job execution.
# The job name, jobid, number of pages processed and pdf files created for each job
# are added to the xenoshistory.txt file
[for file in $(find /d2e/logs/*.rpt -mtime -2 | grep -v ftplog)
do
awk '$3 == "Application" {QName = $6}
$2 == "XifPages" {pages = $6}
$2 == "XifEndOfDocuments" {files = $6}
index($0,"CompletionCode") && index($1,"Info"){sevGTI = 1}
END {if (sevGTI)
printf "%10s%10s%7s%s",QName,pages,files,ORS
}
' $file>>/home/p611568/new.txt
chmod 775 /home/p611568/new.txt
echo $' QName\tPages\tFiles' | cat - new.txt > count.txt
done]
Currently the ouput file looks like this but I need a date where the xxxx is
$ cat new.txt
XXXXX
QName Pages Files
efvahi1 102 85
efvahi1 102 85
Code tags for code, please.
The extra brackets in your code would prevent it from working.
yes I thought that was what you meant for the code. I placed brackets around it. I don't understand what you mean by code tags That is why I used the brackets for code tags. do you know what I could do to get it to work with a date without the brackets as I have it working I just need a date where the xxx
is?
---------- Post updated at 05:46 PM ---------- Previous update was at 05:37 PM ----------
#!/usr/bin/ksh
# This script reads the *.rpt files created by xenos during job execution.
# The job name, jobid, number of pages processed and pdf files created for each job
# are added to the xenoshistory.txt file
for file in $(find /d2e/logs/*.rpt -mtime -2 | grep -v ftplog)
do
awk '$3 == "Application" {QName = $6}
$2 == "XifPages" {pages = $6}
$2 == "XifEndOfDocuments" {files = $6}
index($0,"CompletionCode") && index($1,"Info"){sevGTI = 1}
END {if (sevGTI)
printf "%10s%10s%7s%s",QName,pages,files,ORS
}
' $file>>/home/p611568/new.txt
chmod 775 /home/p611568/new.txt
echo $' QName\tPages\tFiles' | cat - new.txt > count.txt
done
Currently the ouput file looks like this but I need a date where the xxxx
is
$ cat new.txt
XXXXX
QName Pages Files
efvahi1 102 85
efvahi1 102 85
I'm confused. You say that your output looks like your input file. And since nothing in your code makes any modifications to that input file (it adds some text at the start of the output file and copies that text to the end of the output), why don't you just change the XXXXX
in the 1st line of the file named new.txt
to be the date string that you want to copy into your output file? Are you saying that the for
loop before the cat
in the pipeline in your script does not find any files to add any data to your output?
And, exactly what date string format did you want to use instead of the XXXXX
that is current in new.txt
and, unless the date string you want is the current date and time when your script is run, where is that date string supposed to be found?