Outputting data from log file to report


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Outputting data from log file to report
# 8  
Old 01-26-2019
Hi ae4ml,
I'm afraid I'm a little more pessimistic than RudiC about our chances for finding the proper pairs of lines to join to produce the output you want.

In post #1 you said that your input was grouped in pairs of two lines each. To get the output shown above, you would have to have pairs of lines in a group that are not adjacent.

If you don't provide us with representative sample input and a clear description of how the input actually appears, we can't be expected to write code that will work.

If you look at the first 10 lines of the input file you used to create the above output, you'll see that there is an unmatched pair of lines starting around line 7 or 8 of the input.

The output you've shown us looks like a very simple case of what computer scientists refer to GIGO (garbage in, garbage out) where garbage refers to data that is not in the expected format.

And looking at your sample data in post #1, we can't use time stamps in pairs of records together with the elapsed times given in the 2nd line in each pair because none of the elapsed times even come close to matching the differences between the time stamps.

It also appears that you have input lines that are of a format not included in your description in post #1. For example, to get the output you've shown us, there have to be lines in the input in a format similar to the following:
Code:
M: 2019-01-25 12:33:55.647 P25, network watchdog has expired, ...

You didn't mention there being any lines in this format in your input files and my code wasn't expecting to see any lines like these. Having them in your input file will certainly cause output that is not in the format you requested.

If you can come up with a more accurate description of your input file format, we might be able to come up with something that comes closer to the output you want.

If your input doesn't have adjacent pairs of lines that are to be used together to produce a line of output, you have to come up with some way to reliably find the 2nd line of a pair of lines that need to be joined to produce your desired output. Since the second line in a pair doesn't include the "from" and "to" tags, I don't see any good way to pair lines if they aren't adjacent.

Sorry,
Don
This User Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Outputting Errors to a Log file

Good Morning, Every so often, I have copy scripts that to don't complete, but I don't immediately know why. It usually ends up being a permissions issue or a length issue. The scripts edit a log file, so I'd like to include any copy errors/issues in that file to check if the copies... (4 Replies)
Discussion started by: Stellaman1977
4 Replies

2. Shell Programming and Scripting

Create a report for client with a text data file

Hi, I am an amateur bash scriptwriter and I need to write a script which creates a report in a formatted, easy to read table-like that is displayed to standard output. The script has to export the followings: Process ID,User Name, Command Name,Priority..... Now I have a file that I can see all... (3 Replies)
Discussion started by: bashily
3 Replies

3. UNIX for Dummies Questions & Answers

outputting set -x to file

I need to enable set -x in my croned script as at times the script is not returning all data that it should be. This only happens intermittently and as such I would like a means of being able to check what goes wrong. My question is how to output the debug of set -x to file? (1 Reply)
Discussion started by: rob171171
1 Replies

4. Red Hat

Outputting clive --debug to file?

I am running clive on Linux version 2.6.24.5-85.fc8 (Red Hat 4.1.2-33) with the debug command as follows clive --debug -O <logfile> http://www.youtube.com/watch?v.... I need to get the contents of the debug written to file to extract data later. Using the -O option actually writes the... (0 Replies)
Discussion started by: rob171171
0 Replies

5. Shell Programming and Scripting

Outputting data from multiple lines

Hi guys, looking for a bit of advise, and as I am a complete novice, please excuse the daft questions!! I have a list of events and of which entry looks like this; # # Event 1 # NAME = Event 1 # 12345 : 123 : 1 : 1 : L,1,N : 1,0 : Event # # Event 2 # NAME = Event 2 # 12346... (8 Replies)
Discussion started by: JayC89
8 Replies

6. Shell Programming and Scripting

outputting data in table from grep results

Hi all. I'm a real unix newbie and looking for some help on a shell scripting problem. I'm going the longest ways around everything but I'm getting there. My next problem however has me stumped. I have set up a program that takes inputs from a user for a particular month and year (and stores them... (2 Replies)
Discussion started by: Chillspark
2 Replies

7. UNIX for Dummies Questions & Answers

create data file from report file

Dear Ones, kindly help me to create a data file from the report file as shown here under( i am new one to unix KNOW BASIC COMMANDS) file:rama.prt (ist record)(3 to 4 lines of text with different filed names) Name :M.LALITHA DOB:12/11/45 DESG :JA(P) STANO:300175 ... (3 Replies)
Discussion started by: cvvsnm
3 Replies

8. Shell Programming and Scripting

Outputting formatted Result log file from old 30000 lines result log<help required>

Well I have a 3000 lines result log file that contains all the machine data when it does the testing... It has 3 different section that i am intrsted in 1) starting with "20071126 11:11:11 Machine Header 1" 1000 lines... "End machine header 1" 2) starting with "20071126 12:12:12 Machine... (5 Replies)
Discussion started by: vikas.iet
5 Replies

9. Shell Programming and Scripting

Help in outputting the result in log files

This is the file am having: "40","1G1AL55 ",30482,9000 "40","1G1ZT58 ",29098,10600 "40","1G1AL15 ",29222,9400 "46","1G6KD57 ",3083,28400 "46","1G6KD57 ",27909,25200 "49","1G1ZU57 ",16391,13900 "49","1G2ZG58 ",28856,12400 I want to display the output in three files... (23 Replies)
Discussion started by: dave_nithis
23 Replies

10. Shell Programming and Scripting

Problem getting data to a report file.

Hi all, I'm trying in vain to workout how I can generate a report from a months worth of files that get created every day. There is one file per day and each daily file contain the output from a df -v command. With the following section of code ... for xdffile in $1$2/df?? do ... (4 Replies)
Discussion started by: Cameron
4 Replies
Login or Register to Ask a Question