How to get some data in the file? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to get some data in the file?

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-03-2013
pmreddy pmreddy is offline
Registered User
 
Join Date: Apr 2012
Last Activity: 3 July 2013, 2:31 AM EDT
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
How to get some data in the file?

Hi all,

I have a log file with the below data.
I want to get only the red colored data from log file.

Record ----: Rejected may varies from one file to another file.

Please help me how to get some data in the file


Code:
Record 4466: Discarded - failed all WHEN clauses.
Record 4467: Discarded - failed all WHEN clauses.
Record 1632: Rejected - Error on table NOR_DATA, column COMPANY_NUM.
 ORA-01722: invalid number
Record 1659: Rejected - Error on table NOR_DATA, column COMPANY_NUM
 ORA-01722: invalid number
  
Table NOR_DATA:
   40 Rows successfully loaded.
   2 Rows not loaded due to data errors.
   4425 Rows not loaded because all WHEN clauses were failed.
   0 Rows not loaded because all fields were null.
  
  
Space allocated for bind array:               40958016 bytes(7216 rows)
 Read   buffer bytes:40960000
  
 
Total logical records skipped:          0
Total logical records read:          4467
Total logical records rejected:         2
Total logical records discarded:     4425
 

Run began on Thu Jan 03 01:14:50 2013
Run ended on Thu Jan 03 01:14:50 2013

 
Elapsed time was:     00:00:00.39
CPU time was:         00:00:00.23


Last edited by Scrutinizer; 01-03-2013 at 07:36 AM.. Reason: code tags
Sponsored Links
    #2  
Old 01-03-2013
PikK45 PikK45 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 26 November 2014, 5:10 AM EST
Location: Chennai
Posts: 567
Thanks: 43
Thanked 74 Times in 72 Posts
Do you want to get these red colored lines just because the status says "rejected"??
Sponsored Links
    #3  
Old 01-03-2013
pmreddy pmreddy is offline
Registered User
 
Join Date: Apr 2012
Last Activity: 3 July 2013, 2:31 AM EDT
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Yes, but the rejected lines may vary from file to file.
    #4  
Old 01-03-2013
PikK45 PikK45 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 26 November 2014, 5:10 AM EST
Location: Chennai
Posts: 567
Thanks: 43
Thanked 74 Times in 72 Posts
In short, you want to copy all the lines after the phrase "Rejected" occur, to a new file. Correct?
Sponsored Links
    #5  
Old 01-03-2013
pmreddy pmreddy is offline
Registered User
 
Join Date: Apr 2012
Last Activity: 3 July 2013, 2:31 AM EDT
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Need to include rejected phrase also in the new file.
Sponsored Links
    #6  
Old 01-03-2013
Jotne's Avatar
Jotne Jotne is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 20 September 2014, 2:08 AM EDT
Posts: 1,040
Thanks: 62
Thanked 216 Times in 204 Posts
You like all lines from first found Rejected to end of file?


Code:
awk '{if ($0~"Rejected") a=1}0 {print}a' infile


Last edited by Jotne; 01-03-2013 at 04:01 AM..
Sponsored Links
    #7  
Old 01-03-2013
pmreddy pmreddy is offline
Registered User
 
Join Date: Apr 2012
Last Activity: 3 July 2013, 2:31 AM EDT
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
yes. Correct.

where to include file name like from file, to 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
Extract header data from one file and combine it with data from another file nex_asp Shell Programming and Scripting 17 01-20-2013 09:53 AM
Mapping a data in a file and delete line in source file if data does not exist. kokoro UNIX for Dummies Questions & Answers 4 08-20-2012 04:10 PM
How to get data only inside polygon created by points which is part of whole data from file? reva UNIX for Dummies Questions & Answers 7 04-12-2010 12:27 PM
Find and replace data in text file with data in same file timothyha22 Shell Programming and Scripting 0 12-09-2009 04:28 PM



All times are GMT -4. The time now is 09:32 PM.