There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard netgear network printer problem ram registry repair router slow software sound toshiba trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless xbox
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
Duplicate records spool to excel file

Reply  
Thread Tools
ron17's Avatar
Junior Member with 1 posts.
 
Join Date: Oct 2008
15-Oct-2008, 05:54 AM #1
Duplicate records spool to excel file
hi,

i need to identify the duplicate records (in terms of given primary key fields) in a pipe ('|') delimited text file, and spool these duplicates into excel file. i'm illustrating this below:


input file (in txt file):

abc|123|jon|male |brown
xyz|456|may|female|red
xyz|456|may|female|orange
klm|234|mac|male |black
opq|561|may|male |green
klm|234|ace|male |black
klm|234|ron|male |black


output file (in excel format):

xyz|456|may|female|red
xyz|456|may|female|orange
klm|234|mac|male |black
klm|234|ace|male |black
klm|234|ron|male |black


* the 1st two fields are the primary key fields



thanks!
lotuseclat79's Avatar
Distinguished Member with 21,345 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
15-Oct-2008, 07:05 PM #2
Hi Ron17,

Welcome to TSG!

We are not a homework solving website, but you can learn as you go here.

Cat the input file into a pipe, |, and use the sort command with '|' as the specified separator field, and specify the key field you are sorting upon, e.g.:
$ cat input-file | sort ...

Read the man page for the sort command and play with it until you have solved your problem.
$ man sort

-- Tom
__________________
The independence created by philosophical insight is - in my opinion - the mark of distinction
between a mere artisan or specialist and a real seeker after truth. - Einstein 1944
Imagination is more important than knowledge. - Einstein
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:47 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.