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
retrieve value from a file satish@123 Shell Programming and Scripting 1 05-17-2008 08:40 AM
Converting Binary decimal coded values to Ascii Values gaur.deepti UNIX for Advanced & Expert Users 3 04-02-2008 01:33 PM
Retrieve data from a file tpltp Shell Programming and Scripting 2 03-28-2008 05:36 AM
Need to find only unique values for a given tag across the files sudheshnaiyer UNIX for Dummies Questions & Answers 8 09-03-2007 01:53 AM
how to retrieve IP address of a machine mridula IP Networking 5 11-02-2005 09:21 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 02-05-2007
mahalakshmi mahalakshmi is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 38
to retrieve unique values

Hi all,
I have a 10.txt file. In this file 2 words are present by name Active and Inactive and these words are repeated 7000 times. I want to take the unique 2 words from this 7000 lines.

Thanks
Mahalakshmi.A
  #2 (permalink)  
Old 02-05-2007
tayyabq8's Avatar
tayyabq8 tayyabq8 is offline Forum Advisor  
Moderator
  
 

Join Date: Nov 2004
Location: Bahrain
Posts: 579
Although your question is not clear, a sample input/output would help. But I'll assume that you want extract unique names from the first column of your input file:
Code:
sort -k 1,1 -u inputfile
Above will give you the last occurrence of names.
  #3 (permalink)  
Old 02-05-2007
mahalakshmi mahalakshmi is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 38
It's working fine. I would like to know about the -u -k optiosn in the sort command. Could you please explain.

thanks
  #4 (permalink)  
Old 02-05-2007
tayyabq8's Avatar
tayyabq8 tayyabq8 is offline Forum Advisor  
Moderator
  
 

Join Date: Nov 2004
Location: Bahrain
Posts: 579
Quote:
Originally Posted by mahalakshmi
It's working fine. I would like to know about the -u -k optiosn in the sort command. Could you please explain.

thanks
-k 1,1 sort the content of inputfile using first column as the primary sort key and -u is there to display uniq values only. Read the man sort for more details.
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:46 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