Getting detail out of a log file...


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Getting detail out of a log file...
# 1  
Old 08-22-2002
Getting detail out of a log file...

I'd like to peruse a log file and from it generate another file from the first instance of "Jul 11" to the first instance of "Jul 18" within the log file.
# 2  
Old 08-22-2002
Re: Getting detail out of a log file...

Quote:
Originally posted by Cameron
I'd like to peruse a log file and from it generate another file from the first instance of "Jul 11" to the first instance of "Jul 18" within the log file.
Are you wanting Jul 11 and Jul 18 to be the lower and upper limit and display everything between?

For first instance finding, I found this thread (that I participated in) in the search:

https://www.unix.com/showthread.php?s...first+instance
# 3  
Old 08-22-2002
You could also probably strip that out with a fairly simple shell script - can you post a rough example of the format of the log file?
# 4  
Old 08-22-2002
This is the sort of thing I would be likely to want to...so I had a play and see if this will work for you:

Code:
#!/bin/ksh
#
start_row=`awk -F"," '{ if ( $1 == "one" && start_def != "True" )
        { start_def="True"; start_row = NR -1 ; print start_row}} ' biglog`
#
end_row=`awk -F"," '{ if ( $1 == "two" && end_def != "True" )
        { end_def = "True" ; end_row = NR +1 ; print end_row}} ' biglog`
#
sed -e "1,$start_row d" -e "$end_row,$ d" biglog > new_file

It's probably not as pretty as it could be....and it is assuming that the value will be in the first field..... but you can tweak it of course.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Tape Drive Detail

Hi, I am using HP Ultarium Tape drive to backup my oracle DB. Is that any command to identify the tape serial number or any other tape details that inserted into the tape drive? (2 Replies)
Discussion started by: tharmendran
2 Replies

2. AIX

Disk Usage in Detail !!

Hi ALL, I always use du command for analyzing diskusage to housekeep a filesystem. Can somebody tell the where first row filesize resides? bash-3.2# df -gt /tmp Filesystem GB blocks Used Free %Used Mounted on /dev/hd3 16.50 10.01 6.49 61% /tmp bash-3.2# bash-3.2# pwd... (6 Replies)
Discussion started by: Thala
6 Replies

3. Shell Programming and Scripting

Detail on For loop for multiple file input and bash variable usage

Dear mentors, I just need little explanation regarding for loop to give input to awk script for file in `ls *.txt |sort -t"_" -k2n,2`; do awk script $file done which sorts file in order, and will input one after another file in order to awk script suppose if I have to input 2 or... (4 Replies)
Discussion started by: Akshay Hegde
4 Replies

4. AIX

about detail scope in AIX

I am mac end user learn some shell and applescripting I am looking AIX as system admin as career and learning AIX p520 what is scope of AIX as admin and about technology in demand in market I am confused, can anybody from AIX elaborate or mail me some experience please: (1 Reply)
Discussion started by: himanshuk
1 Replies

5. UNIX for Dummies Questions & Answers

Product instalaltion detail

Hi all experts, I want to find out what oracle product has come with the server and their version detail. We have Solaris 10. Can you tell me what Unix command will full fill this requirement? Thanks, AJ -----Post Update----- please help -----Post Update----- please help guys (1 Reply)
Discussion started by: ma466
1 Replies

6. Solaris

Patch detail and link

Hi All, My system patch detail is below Generic_12712-11 sun4u . can you please, what patch level is needed and where can i get it . Thanks (9 Replies)
Discussion started by: kumarmani
9 Replies

7. UNIX for Advanced & Expert Users

Top command in detail

hi frnds when i run the top it wil give the following o/p i want to know what it indicate ....??? what is us,sy,ni,id,wa ,etc .....?? ------------------------------- o/p -------------------- Tasks: 551 total, 1 running, 550 sleeping, 0 stopped, 0 zombie Cpu(s): 6.0%us, 3.2%sy, ... (1 Reply)
Discussion started by: luckypower
1 Replies

8. Shell Programming and Scripting

change record detail...in file

hello, I have a file with the following record: a.txt AAjohn10123403 AAmary10298411 AAcat120192a1030 AApeter094857 AAmaybb019485 I have a list called b.txt, if matched the name and it will change to new name (which is after space) john1 cancel cat12 cat12 peter peter mary1... (5 Replies)
Discussion started by: happyv
5 Replies

9. Solaris

how to use the grep to find detail in a file

I need to search say a customer account number in a selection of files using 'grep', for example, I need to do the following; using grep to locate '020 117 in the mail files (mail files-txt) cheers (1 Reply)
Discussion started by: etravels
1 Replies

10. UNIX for Advanced & Expert Users

what does metaroot in detail?

I have a problem with a submirror of the root filesystem, in the procedure in order to unmirror the FS say: metadetach -f d0 d20 metaroot c0t0d0s0 but, in my system the metaroot cause a segmentation fault coredump. I knew that the command modify the /etc/system and the /etc/vfstab. I try... (3 Replies)
Discussion started by: hugo_perez
3 Replies
Login or Register to Ask a Question