I have requirment to parse the file based on the follwing conditions and write the O/P to other file (which is '|' seperated) based on the following conditions.The records in the file are delimiter by space and the number of spaces also not fixed.
1.General:
1.1 Select only those records where a record contains drop or reject.
1.2. Remove the empty line between the rows in the file
2. DateTime: pick date from 1st field and time from 2nd field and change the format to DD/MM/YYYY 24HH:MM:SS.
3. Action: 3nd field in the row
4. Device IP : 4rd filed in the row
5. Interface_Name : 5th field in the row after removing '<' or '>', but if we get the "daemon" in that field then we need to pick 5th and 6th fileds.
6. Source IP: pick the value which is present between _src:_ and ;
7. Destination IP : Pick the value which is present between _dst:_ and ;
8. Protocal : Pick the value which is present between _proto:_ and ;
9. Service : Pick the value which is present between _service:_ and ;
10.Product : Pick the value which is present between _product:_ and ;
11.Reject : Pick the value which is present between _reject_category:_ and ;
12.UserName : Pick the value which is present between _user:_ and ; Note: _ denotes the space in the file
Example,
Input Records:
Output Records:
Regards,
MKS
Last edited by Franklin52; 11-24-2010 at 05:47 AM..
Reason: please use code tags
Hi Gurus,
i have files like this and i want to rename it.
server1_0_Log0000597500
server1_0_Log0000597501
server1_0_Log0000597502
server1_0_Log0000597503
server1_0_Log0000597504
server1_0_Log0000597505
server1_0_Log0000597506
server1_0_Log0000597507
server1_0_Log0000597508... (7 Replies)
Hey guys,
I have this file generated by me... i want to create some HTML output from it.
The problem is that i am really confused about how do I go about reading the file.
The file is in the following format:
TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Here is a data file, which I believe is in YAML. I am trying to retrieve just the 'addon_domains" section, which doesnt seem to be as easy as I had originally thought. Any help on this would be greatly appreciated!! I have been trying to do this in awk and mostly bash scripting instead of perl... (3 Replies)
Hi Experts,
Im a new bee for scripting,
I would ned to do the following via linux shell scripting, I have an application which throws a log file, on each action of a particular work with the application, as sson as the action is done, the log file would vanish or stops updating there, the... (2 Replies)
Hello,
I have a file which contains groups of fields. These groups are separated by a blank line, to form a logical record.
Each line consists of a field-value pair.
If want to find all records where field 'd' has a value of '4' and if it does, I want the value of field 'a' (from the... (4 Replies)
Hi Scripting Gurus,
I am trying to parse a csv file and generate a new output file.
The input file will be a variable length in turns of rows and columns.
output file will have 8 columns. we have three columns from the header for each set.
just to give little bit more clarification each row... (15 Replies)
I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves.
Also, the script should only move a file from /exports to... (6 Replies)
Hi,
I need a shell script that would parse this file
/usr/share/i18n/locales/aa_DJ:title "Afar language locale for Djibouti (Cadu/Laaqo Dialects)."
/usr/share/i18n/locales/aa_ER:title "Afar language locale for Eritrea (Cadu/Laaqo Dialects)."
/usr/share/i18n/locales/aa_ER@saaho:title... (2 Replies)