![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| change record detail...in file | happyv | Shell Programming and Scripting | 5 | 03-12-2007 01:06 AM |
| Reading file names from a file and executing the relative file from shell script | anushilrai | Shell Programming and Scripting | 4 | 03-10-2006 05:25 AM |
| how to use the grep to find detail in a file | etravels | SUN Solaris | 1 | 03-10-2004 02:03 PM |
| what does metaroot in detail? | hugo_perez | UNIX for Advanced & Expert Users | 3 | 08-05-2003 05:18 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
Re: Getting detail out of a log file...
Quote:
For first instance finding, I found this thread (that I participated in) in the search: finding first instance |
|
||||
|
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
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|