Advertisement

04.25.2008 at 02:47PM PDT, ID: 23355075
[x]
Attachment Details

Bash combine messages based on columns.

Asked by TSRich01 in Linux Programming, Unix Systems Programming, Kernel And Operating System Specific Programming

Tags: Bash

I have a script that generates a backup error log for several accounts we have.  .  What I need is to group errors based on a few static pieces of information.. The file has about 8,000 lines.

What I want to do is take the lines that match based on certain fields I want to group them and show the first line and count how many show up (including the line being shown).  I will attach the file.  

Here is what I want that file to look like when it is done:

TS00600038 has the below errors:
Error: ECN5 Cat: 7 Code: Access is denied. (\\\\SERVER01\\D$\\Users\\maryf\\My Documents\\) Found: 9 times
Error: ECN53 Cat: 7 Code: The network path was not found. (\\\\WSK02\\C$) Found:2 times

TS00600233 has the below errors:

Error: ECN-1073741763 Cat: 1  Failed to send buffer. (supdate.exe) ECN-1073741763 Found: 2 Times
Error: ECN-1073741801 Cat: 1 Lost connection to System. ECN-1073741801 Found: 2 times.

My thoughts were to use an awk string to do this but I don't know how hard it would be to that.  Is this even possible?

Now the file I am giving here does not have tab separation but I can do that.  Start Free Trial
Attachments:
 
Error listing.
 
[+][-]04.26.2008 at 07:36AM PDT, ID: 21445658

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.26.2008 at 08:18AM PDT, ID: 21445796

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.26.2008 at 09:58AM PDT, ID: 21446093

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Linux Programming, Unix Systems Programming, Kernel And Operating System Specific Programming
Tags: Bash
Sign Up Now!
Solution Provided By: mish33
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628