Cut particular lines | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


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 !!

Cut particular lines

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-22-2013
arul1185 arul1185 is offline
Registered User
 
Join Date: Feb 2013
Last Activity: 22 February 2013, 4:31 AM EST
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Cut particular lines

All,

I would like to cut all the lines from the log file for the timestamp . I'm not clear about how to apply grep ,awk here.Can you help me on this ?

My logfile:
**********


Code:
Wed Feb 20 03:48:26 2013
Thread 1 advanced to log sequence 400 (LGWR switch)
Thu Feb 21 02:34:23 2013
Starting background process CJQ0
Thu Feb 21 02:34:23 2013
CJQ0 started with pid=14, OS id=29548
Thu Feb 21 03:00:00 2013
Fri Feb 22 03:00:04 2013
Begin automatic SQL Tuning Advisor run for special tuning task  "SYS_AUTO_SQL_TUNING_TASK"

My output should be: - I need Feb21 content here.
*******************

Code:
Thu Feb 21 02:34:23 2013
Starting background process CJQ0
Thu Feb 21 02:34:23 2013
CJQ0 started with pid=14, OS id=29548
Thu Feb 21 03:00:00 2013

Thanks
Arul

Moderator's Comments:
edit by bakunin: when we told you in the rules and in the form with which you opened the thread to use CODE-tags we really meant it. Please do so from now on. It can't be that hard to find the button labeled "CODE", no?

Last edited by bakunin; 02-22-2013 at 02:17 PM..
Sponsored Links
    #2  
Old 02-22-2013
RudiC RudiC is offline Forum Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 30 October 2014, 9:58 AM EDT
Location: Aachen, Germany
Posts: 4,474
Thanks: 73
Thanked 1,097 Times in 1,033 Posts
Please use code tags as required by forum rules.

Your request is not that easy to fulfill as the file structure (time stamp \n line) is not consistenely followed, so further evaluations need to be applied. For a start, try
Code:
awk 'match($0, dt) {print; getline; print}' dt="Feb 21" file

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cut Lines using grep bhupinder08 Shell Programming and Scripting 3 08-11-2012 04:34 PM
cut particular lines from a file kvok UNIX for Dummies Questions & Answers 2 05-12-2010 07:58 AM
cut lines in a file. jimmy_y Shell Programming and Scripting 5 07-28-2009 03:30 AM
Cut lines before keyword Trump Shell Programming and Scripting 4 03-18-2009 11:08 PM
cut 11 lines from a file turk22 Shell Programming and Scripting 7 05-12-2006 03:02 PM



All times are GMT -4. The time now is 03:42 AM.