Report generation based on certain conditions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Report generation based on certain conditions
# 1  
Old 04-27-2012
Report generation based on certain conditions

Hi I recently joined a project where I have been asked to generate a report using shell script accessing UNIX box.
I have no idea on how to do it as I am a beginner and learning shell scripts.

Suppose I have a XML:

Code:
Code:
<XYZRequest><effectiveDate>someDate</effectiveDate><expiryDate>someDate</expiryDate><reason>blahblah</reason>.....</XYZRequest>

This XML will be in one of the logs. I need to search for the element XYZ in logs and then check inside the XML for effectiveDate in the past and expiryDate as currentDate and if the condition succeeds check for the response <XYZResponse> in the logs and check if there is any error inside the elements say for example
Code:
<XYZResponse><Solution>Error</Solution></XYZResponse>.

If there is any entry in logs with Error, generate a report with the details if not generate a report saying no issues. Can someone pls help me.Smilie
# 2  
Old 04-27-2012
A more generalized example will help us to understand better.

Example with dates etc.
# 3  
Old 04-27-2012
Hi - I cant think of generalizing this further.
# 4  
Old 04-27-2012
If your data contains newlines, you may be able to extract lines that contain your search criteria with grep, then do more processing on what is returned. It might also help to use
Code:
grep -A

or
Code:
grep -B

to get 1 or 2 lines before or after the search text.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Report generation using script

Hi all I have a unix script that generates a report with the following information: uptime, mounted file systems, disk usage (> 90% --> critical, <75%-90%> --> warning, < 75% healthy), Mem usage, CPU usage and load average. But I would like to create one single report containing all this... (5 Replies)
Discussion started by: fretagi
5 Replies

2. Shell Programming and Scripting

Help with Creating file based on conditions

Can anyone please assist? I have a .txt file(File1.txt) and a property file(propertyfile.txt) . I have to read the vales from the property file and .txt file and create the output file(outputfile.txt) mentioned in the attachment. For each record in .txt file,the below mentioned values shall be... (20 Replies)
Discussion started by: vinus
20 Replies

3. Shell Programming and Scripting

Split File based on different conditions

I need to split the file Conditions: Ignore any record that either starts with 1 or 9 Split the file at position 404 , if position 404 is abc or def then write all the records in a file > File 1 , the remaining records should go in to a file > File 2 Further I want to split the... (7 Replies)
Discussion started by: protech
7 Replies

4. Shell Programming and Scripting

File Report Generation

hi all i need to generate a report file that contains the following details of files present in a directory. 1. File name 2.Complete path for each files and directory 3.File size 4.Days older example i have a directory testing that contains sub-directories and some files. i need to make a... (5 Replies)
Discussion started by: yashwantkumar
5 Replies

5. Shell Programming and Scripting

Report Generation with Grep

All, I am pretty new to Unix Environment. I am not sure if my requirement can be accomplished in Unix. I did try searching this forum and others but could not get an answer. Requirement is explained below: I have a set of files in a folder. file1_unload file2_unload file3_unload... (7 Replies)
Discussion started by: bharath.gct
7 Replies

6. Shell Programming and Scripting

validating a file based on conditions

i have a file in unix in which the records are like this aaa 123 233 aaa 234 222 aaa 242 222 bbb 122 111 bbb 122 123 ccc 124 222 In the output i want only the below records aaa ccc The validation logic is 1st column and 2nd column need to be considered if both columns values are... (8 Replies)
Discussion started by: trichyselva
8 Replies

7. Shell Programming and Scripting

extract lines based on few conditions

Hi, I need to extract lines based on some conditions as explained below: File format details: notes: 1. each set starts with AAA only 2. number of columns is fixed 3. number of rows per set may vary (as one set is upto DDD - 4 rows) Now, if any BBB's 5th column is blank then then... (4 Replies)
Discussion started by: prvnrk
4 Replies

8. Shell Programming and Scripting

Report generation

Hello, I got a requirement in writing a KSH script in unix, please help me out the requirement is there are two folders Folder1 and Folder2 and there are same files in the different folders. like file1,file2 in folder1 and file1 and file2 in folder2. I would like to compare all the similar... (3 Replies)
Discussion started by: gmahesh2k
3 Replies

9. UNIX for Dummies Questions & Answers

report generation

Hello, I got a requirement in writing a sheel script in unix, please help me out the requirement is there are two folders Folder1 and Folder2 and there are same files in the different folders. like file1,file2 in folder1 and file1 and file2 in folder2. I would like to compare all the... (2 Replies)
Discussion started by: gmahesh2k
2 Replies

10. Shell Programming and Scripting

Oracle Report generation

Hi, I am beginner in shell programming.In a shell script i found a call to a script 'runrep25m',which i think is to generate oracle reports?Could anyone help me by providing some details about its usage With Thanks & Regards Dileep (7 Replies)
Discussion started by: DILEEP410
7 Replies
Login or Register to Ask a Question