Parse log files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Parse log files
# 8  
Old 03-18-2015
Hi Rudi,

That was the obvious choice, you are right. But in this case we need to stick to the content itself, not to the file variable.
What was requested is that also the file+timestamp information (before >>) is added.

Regards,
Andrei
# 9  
Old 03-18-2015
An awk $1 is not the same as a script (bash, ksh, csh...) $1.
While $1 is a variable within all scripts, $1 is the first field of the currently parsed inputline.

hth

Last edited by sea; 03-18-2015 at 07:49 PM..
# 10  
Old 03-18-2015
Quote:
Originally Posted by sea
And awk $1 is not the same as a script (bash, ksh, csh...) $1.
While $1 is a variable within all scripts, $1 is the first column of output with awk.

hth
Hi sea,
Just so we don't confuse tandrei too much, I think you have a typo above. In awk, $1 is the first field of the current input line; not the first column in the output.

With RudiC's script, tandrei will probably need to look at $1 and $2 (or use a different substr(...) after matching the file and timestamp terminator ( >)). With my script, $1 will be sufficient, but FS ERE will need to be updated to add >> as another field separator.
# 11  
Old 03-18-2015
...lost in translation... post updated
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parse audit log

I am trying to parse the audit log to find a particular date that associated with a user record. The Date and the context of the record that I need to extract from the audit.log are 11-07-2015, the username and the activity he or she performed that day. Here is my code: grep -c date -d... (3 Replies)
Discussion started by: dellanicholson
3 Replies

2. Shell Programming and Scripting

Parse A Log File

Hello All, Below is the excerpt from my Informatica log file which has 4 blocks of lines (starting with WRITER_1_*_1). Like these my log file will have multiple blocks of same pattern. WRITER_1_*_1> WRT_8161 TARGET BASED COMMIT POINT Thu May 08 09:33:21 2014... (13 Replies)
Discussion started by: Ariean
13 Replies

3. Shell Programming and Scripting

Parse 2 or more files into one.

Hi, I have a really simple question...I think. I want to be able to parse two or more files into one by reading the first record from each file into new file then go back to the first file and start reading the second record in from each file into new file and so on. I am new to using awk and am... (5 Replies)
Discussion started by: qray2011
5 Replies

4. UNIX for Dummies Questions & Answers

How can i parse my Unix log files??

Hello, i would like to parse Unix log files and i would like to use a Unix syslog analyzer. I'm going to use Eucalyptus and i would like to parse its log files. Is there any open source/free syslog parser?? Thanks, in advance! (2 Replies)
Discussion started by: g_p
2 Replies

5. Shell Programming and Scripting

parse log with sed

I've been searching for an hour on how to parse a file like this: 10.200.5.83 - - "GET /portal/edits.js HTTP/1.1" 200 24324 10.200.5.83 - - "GET /portal/objects/PortalConfig.js HTTP/1.1" 200 12187 10.200.5.84 - - "GET /portal/objects/CommonDialog.js HTTP/1.1" 200 8283 10.200.5.84 - - "GET... (4 Replies)
Discussion started by: dba_frog
4 Replies

6. Shell Programming and Scripting

Parse the log file

./abc.sh started at Sun Oct 24 06:42:04 PDT 2010 Message: ======= Summary Report of NAME count ----------------------------------------------------------------- Below is the output of the SQL query :- NAME COUNT... (2 Replies)
Discussion started by: sandy1028
2 Replies

7. Shell Programming and Scripting

Help to create a script to parse log files

Hello everybody, I need some help here to create a script to parse a log file. Here is a sample of the log file : 0x42258940 (Debug) Cache SUMMARY attrs now/668 min/668 max/668. 0x42258940 (Debug) RSVD SUMMARY reserved space max requested/128 MB accounted now/0 MB 0x42258940 (Debug)... (12 Replies)
Discussion started by: Samb95
12 Replies

8. Shell Programming and Scripting

perl parse log

Hi anyone can help.how can i get all second column data in this log below?? x 799002577959.pdf, 25728 bytes, 51 tape blocks x 800002357216.pdf, 25728 bytes, 51 tape blocks x aadb090910.txt, 80424 bytes, 158 tape blocks x tsese090909.txt, 13974 bytes, 28 tape blocks (4 Replies)
Discussion started by: netxus
4 Replies

9. Shell Programming and Scripting

shell scripts that parse log files

hi all ,i would like a shell script that parses log files and checks the contents for any anonalities,please help,thanks (4 Replies)
Discussion started by: trueman82
4 Replies
Login or Register to Ask a Question