The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
script needed... urgent arp@g7 Shell Programming and Scripting 0 03-04-2008 12:18 AM
Script Needed Urgent in shell or PERL!!!!!!!!!!!!!!!!!!!! aajan Shell Programming and Scripting 1 10-24-2007 04:28 AM
script needed urgent jayaramanit Shell Programming and Scripting 2 09-11-2007 08:35 AM
Urgent Script Needed skyineyes UNIX for Dummies Questions & Answers 1 06-20-2007 04:36 AM
Urgent help needed - shell script aarora_98 SUN Solaris 3 01-25-2007 02:26 PM

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

Join Date: Jun 2007
Posts: 80
Script Needed!!!!!!!! Urgent

How to find unique lines in a file without using 'uniq' and 'sort' command in k shell...
  #2 (permalink)  
Old 09-07-2007
jaduks's Avatar
jaduks jaduks is offline
Registered User
  
 

Join Date: Aug 2007
Location: Assam,India
Posts: 166
jks@LILO:~/prac$ cat flo
this is line1
this is line2
this is line3
this is line2
this is line2
this is line5

in place of "uniq" I can use awk, but sort, I have to use :-)

jks@LILO:~/prac$ cat flo | sort | awk 'X !~ $0; {X=$0}'
this is line1
this is line2
this is line3
this is line5
  #3 (permalink)  
Old 09-07-2007
Klashxx's Avatar
Klashxx Klashxx is offline Forum Advisor  
HP-UX/Linux/Oracle
  
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 393
Try:
Code:
 awk '!($0 in a) {a[$0];print}'  file
  #4 (permalink)  
Old 09-07-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,508
Quote:
Originally Posted by aajan View Post
How to find unique lines in a file without using 'uniq' and 'sort' command in k shell...
you teacher has put these restrictions for your assignment?
Sponsored Links
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 06:17 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