The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Show column names when access a table using perl chriss_58 Shell Programming and Scripting 1 12-23-2008 04:26 PM
Extracting column names from a table.. SQL with UNIX fmina UNIX for Dummies Questions & Answers 4 08-19-2008 02:52 AM
Print column names along with values from SQL thana Shell Programming and Scripting 5 07-24-2008 03:33 AM
Process id's in file names tekster757 UNIX for Dummies Questions & Answers 1 03-07-2008 12:29 PM
Column names in flat files srivsn Shell Programming and Scripting 1 12-27-2005 06:47 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-01-2009
siddiqui siddiqui is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 1
Lightbulb eleminate repated process names and get second column value

i want shell script who can eliminate those repeated process and get value of top process of second column.

Mark with red one only i want other repeated process should be eliminate but how? Help me out guys.


oracle 496094
oracle 471572
oracle 471497
oracle 470561
ko9coll 96157
kuxagent 91252
shlap64 90914
koragent 90591
koragent 90450
ko9coll 90372
tnslsnr 90203
stat_daemon 90196
kux_vmstat 89484
ifstat 89436
nfs_stat 89402
kddsignl 88875
kddsignl 88875
ibmdiradmn 88437
  #2 (permalink)  
Old 01-01-2009
dennis.jacob dennis.jacob is offline Forum Advisor  
dj - the student
  
 

Join Date: Feb 2007
Location: Singapore/Bangalore/Cochin
Posts: 610
Try:


Code:
awk '{ if(a[$1]=="") {a[$1]=$2; print $1" "a[$1]; } }'  filename

  #3 (permalink)  
Old 01-01-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,372

Code:
awk '!x[$1]++' filename

  #4 (permalink)  
Old 01-02-2009
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2007
Location: Beijing China
Posts: 1,092

Code:
#! /usr/bin/perl
open FH,"<a.txt";
while(<FH>){
	my @tmp=split(" ",$_);
	if(! exists $hash{$tmp[0]}){
		print $_;
		$hash{$tmp[0]}++;
	}
}
close FH;

  #5 (permalink)  
Old 01-02-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,184
Idea:
See if your "ps" command has the "-H" (hierarchy) option .
Beware:
1) unix does not necessarily allocate process IDs in numeric order.
2) I have not noticed a process hierarchy with Oracle. On my system the parent process PPID for all Oracle processes is ID 1 (init). Yours may be different.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:31 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0