|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Generate a Summary report
Hi All,
Script to meet my requirement might be simpler for UINIX experts.. ![]() I need to generate an summary report in .txt file using shell script I have Reject directory in Unix server which contains all reject files for three diff categories- Presentation, Chapter and Scene Following are the reject files Reject_Lookup_Error_Presentation.csv Reject_Lookup_Error_Chapter.csv Reject_Lookup_Error_Scene.csv Reject_Read_Error_Presentation.csv Reject_Read_Error_Chapter.csv Reject_Read_Error_Scene.csv _____________________________________________________ Summary report Should be generated by identifying the file name and size. If any of the file size related to Presentation (*_Presentation.csv) is > 0 then. The summary report should display - "Presentation file has error in loading" If all files related to presentation are 0 size then it should display "Presentation file loaded successfully" Now my Summary report should look like below _______________________________________ Presentation file has loaded successfully Chapter file has error in loading Scene file has error in loading _____________________________________ Kindly help me with the code. I need it urgently. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Code:
for file in Presentation Chapter Scene do count=$(find . -type f -prune -name "*_$file.csv" -size +0c -print | wc -l) if [ $count -ne 0 ]; then echo "$file file has error in loading" >> logfile else echo "$file file has loaded successfully" >> logfile fi done Hope this helps |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
@Pikk45
Your code cause the "Reject" directory to be scanned 3 times ... you should change it to do it in one pass instead. ![]() |
|
#4
|
|||
|
|||
|
Code:
find . -type f -prune \( -name "*_Presentation.csv" -o -name "*_Chapter.csv" -o -name "*_Scene.csv" \) -size +0c -print | awk ' /Presentation/{p=p+1}
/Chapter/{c=c+1}
/Scene/{s=s+1}
END {print p, c, s}' | read Presentation Chapter Scene
for count in $Presentation $Chapter $Scene
do
if [ $count -ne 0 ]; then
echo "$count file has error in loading" >> logfile
else
echo "$count file has loaded successfully" >> logfile
fi
done@ctsgnb: Hope this does the trick
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Summary report csv file | inMyZone35 | Shell Programming and Scripting | 2 | 01-20-2013 03:15 AM |
| Parse diff output into very detailed & summary report | gvolpini | Shell Programming and Scripting | 0 | 02-08-2012 09:32 AM |
| generate a report | gustave | Shell Programming and Scripting | 2 | 03-21-2010 04:44 AM |
| generate a report | sailaja_80 | Shell Programming and Scripting | 8 | 08-21-2009 01:12 PM |
| how to add up a total in a summary report? | xiaojesus | Shell Programming and Scripting | 16 | 04-23-2009 03:05 AM |
|
|