Need the distinct of these lines


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need the distinct of these lines
# 1  
Old 09-13-2012
Need the distinct of these lines

Red Hat Enterprise Linux 5.4

I have a text file (error log file) , which has occurences of an error message like

Code:
ORA-01652: unable to extend temp segment by 8 in tablespace xxxxx

There are around 3000 error messages like this in the error log file. But there are only 7 or 8 distinct tablespace names ( shown as xxxx above). The portion highlighted in red is same for all of the error messages. It is just the xxxx part that varies.

How can I get the distint occurences these error messages ?

Sample output of this file


Code:
SQL> create table vendor_dtl_clone1 tablespace TSTDATA
parallel (degree 4)
as select * from vendor_dtl;  2    3
create table vendor_dtl_clone1 tablespace tstdata
*
ERROR at line 1:
ORA-01652: unable to extend temp segment by 8 in tablespace TSTDATA

.
.
some text
.
some text
.
.
.
.
create table SHIP_TRACK_DTL
 (
 shp_track_dtl_id           number(9,0), 
 shp_guide_id               number(9,0), 
 orgn_zip               varchar2(11),
 shp_guide_type               varchar2(2), 
 create_date_time           date,        
 proc_stat_code               number(2,0),
 error_seq_nbr               number(9,0)
)
tablespace brsdata;
create table SHIP_TRACK_DTL tablespace brsdata
*
ERROR at line 1:
ORA-01652: unable to extend temp segment by 8 in tablespace BRSDATA

# 2  
Old 09-13-2012
Code:
awk '/ORA-16152/ && !arr[$(NF)]++'  logfilename

try that
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 09-13-2012
If you are getting same error just try ..

Code:
grep "ORA-01652:" file | sort | uniq -c

This User Gave Thanks to pamu For This Post:
# 4  
Old 09-13-2012
Or maybe something like this?
Code:
awk '/ORA-01652: / && ++a[$NF] == 1' logfile

This User Gave Thanks to Franklin52 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Distinct filenames pattern

Hi All, I am working on designing the archival process for my system, where I will have to find distinct file names ( when excluded time_stamp extention ) from given directory and for each file type keep the latest and move all other older to different location ( lets say dir Back ). Below are... (2 Replies)
Discussion started by: freakabhi
2 Replies

2. Shell Programming and Scripting

Trying to find the distinct lines using uniq command

Platform :Oracle Linux 6.4 Shell : bash The below file has 7 lines , some of them are duplicates. There are only 3 distinct lines. But why is the uniq command still showing 7 ? I just want the distinct lines to be returned. $ cat test.txt SELECT FC.COORD_SET_ID FROM OM_ORDER_FLOW F, -... (2 Replies)
Discussion started by: kraljic
2 Replies

3. Shell Programming and Scripting

Find distinct values

Hi, I have two files of the following format file1 chr1:345-456 chr2:123-456 chr2:455-678 chr3:456-789 chr3:444-555 file2 chr1:345-456 chr2:123-456 chr3:456-789 output (2 Replies)
Discussion started by: jacobs.smith
2 Replies

4. Shell Programming and Scripting

Get the distinct of a particular field

From the below ps output , I want the distinct values of the third field (ie. I need the distinct PPIDs) $ ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 Nov 10 - 48:49 /etc/init root 1769576 1 0 Nov 10 - 0:07... (1 Reply)
Discussion started by: polavan
1 Replies

5. UNIX for Dummies Questions & Answers

Grep distinct

Hello, I have a file which looks like: %_SPE_RDP_NUM_ECH(7)*************% %_SPE_RDP_NUM_ECH(70)************% %_SPE_RDP_NUM_ECH(71)************% %_SPE_RDP_NUM_ECH(72)************% %_SPE_RDP_NUM_ECH(8)*************% %_SPE_RDP_NUM_ECH(9)*************% %_SPE_FLUXPREV_PRES1_MT_HT(2)****%... (5 Replies)
Discussion started by: mvalonso
5 Replies

6. Shell Programming and Scripting

Search distinct files

Hello , Can anyone help me with my below query I am trying to find a text in directory of files via below command grep -i cmps_cgs_crs_rfnc_id * But it returns multiple times same file name i.e if the text found in a file 4 times the file name shown 4 times in the o/p Is... (1 Reply)
Discussion started by: Pratik4891
1 Replies

7. Web Development

SQL - Distinct plus more

Hi all, I have an interesting and I am sure simple question for yau'll. Basically this is what I am after: The table: CREATE TABLE places (id INT, city VARCHAR(24), name VARCHAR(24)); The data: id = 1, city = canberra, name = aaron id = 2, city = canberra, name = andrew id = 3, city... (4 Replies)
Discussion started by: STOIE
4 Replies

8. Shell Programming and Scripting

distinct values of all the fields

I am a beginner to scripting, please help me in this regard. How do I create a script that provides a count of distinct values of all the fields in the pipe delimited file ? I have 20 different files with multiple columns in each file. I needed to write a generic script where I give the number... (2 Replies)
Discussion started by: vukkusila
2 Replies

9. UNIX for Dummies Questions & Answers

how to pick distinct records..........

How can i pick distinct records which consists of duplicate data from a ASCII file using UNIX commands (3 Replies)
Discussion started by: ss4u
3 Replies
Login or Register to Ask a Question