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
Help needed for Shell Script..... pulkit Shell Programming and Scripting 0 02-22-2008 07:25 AM
shell script Help Needed!! smallu UNIX for Dummies Questions & Answers 0 01-15-2008 08:40 PM
Help with awk/shell script needed! inditopgun Shell Programming and Scripting 3 07-20-2007 12:23 PM
shell script help needed fastgoon Shell Programming and Scripting 3 07-17-2006 04:24 PM
Shell Script needed urgently vas_dba Shell Programming and Scripting 2 03-11-2005 09:00 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 10-24-2007
nvuradi nvuradi is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 23
Help needed in Shell Script

Hi



I have the following columns in my input file which is sorted on ColA



colA colB colC colD colE



The data is such that for a single colA it can have multiple values of other columns, for eg the data can be



colA colB colC colD colE

1 1 1 1 1

1 2 1 1 1

1 3 1 1 1

1 4 1 1 1

1 5 1 1 1

2 1 1 1 1

2 2 1 1 1

2 3 1 1 1

2 4 1 1 1

2 5 1 1 1





I need to check the records based on ColA, for value of ColA(1) I need to check the other columns for the next value of colA(2) and so on. If other columns (col B,C,D,E) match exactly for all the colA values then I need to pass only on record to output file.

I need to check whether all the records with value of ColA as 1 matched with the all the records with Value of ColA as value other than 1





Basically, I need to compare the current and previous complete records (consisting of 5 columns). If they match, then I have to pass only one such occurrence of the record.



Consider the second scenario

colA colB colC colD colE

1 1 1 1 1

1 2 1 1 1

1 3 1 1 1

1 4 1 1 1

1 5 1 1 1

2 1 1 1 1

2 2 1 1 1

2 3 1 1 1





In this case even though the columns B, C, D, E match for different values of ColA but not all the rows of ColA with value 1 matched with the colA with Value 2, so in this case I need to output file 2 records each for different values of ColA.



Any idea how do I go about this
  #2 (permalink)  
Old 10-24-2007
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
check the uniq command if it solves your problem
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 01:37 PM.


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