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
using sed to get rid of duplicated columns... fedora Shell Programming and Scripting 5 11-28-2008 10:45 AM
Help removing lines with duplicated columns yahyaaa Shell Programming and Scripting 14 05-17-2008 07:33 AM
Remove spaces from columns jacks Shell Programming and Scripting 2 01-18-2008 10:08 AM
remove duplicated lines without sort lalelle Shell Programming and Scripting 6 08-21-2007 07:44 AM
remove duplicated xml record in a file under unix happyv Shell Programming and Scripting 8 09-20-2006 01:36 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 02-21-2008
kamel.seg kamel.seg is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 57
remove duplicated columns

hi all,

i have a file contain multicolumns, this file is sorted by col2 and col3.

i want to remove the duplicated columns if the col2 and col3 are the same in another line.

example
fileA

AA BB CC DD
CC XX CC DD
BB CC ZZ FF
DD FF HH HH


the output is
AA BB CC DD
BB CC ZZ FF
DD FF HH HH

thanks
  #2 (permalink)  
Old 02-21-2008
manikantants manikantants is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 131
uniq -f1 -f2 -c file1
  #3 (permalink)  
Old 02-21-2008
kamel.seg kamel.seg is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 57
it works but i have also in the file i get the occurence number of the line
can i remove it ??
  #4 (permalink)  
Old 02-21-2008
manikantants manikantants is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 131
just remove '-c' option
  #5 (permalink)  
Old 02-21-2008
kamel.seg kamel.seg is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 57
yes it work but the file a have have many columns and i want just to compare the colx and coly and ignor the rest what can i do, because f1 and f2 ignore the two first columns??
  #6 (permalink)  
Old 02-21-2008
manikantants manikantants is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 131
yes give the columns to be avoided with -f option.
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 09:08 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