Filter Condition in sequential file

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Filter Condition in sequential file

Post by Magesh_bala »

Hi,

My Source file is an Sequential file, Where i have duplicate values in my Sequential file.
I have select only unique records from my source.
I dont wanted to use any other stage's to filter the duplicates, Because we have Filter option in Sequential file.
By using the filter option can i do it ???

Please revert back with an clear unix commend to be used.

Regards
Magesh
sud
Premium Member
Premium Member
Posts: 366
Joined: Fri Dec 02, 2005 5:00 am
Location: Here I Am

Re: Filter Condition in sequential file

Post by sud »

Magesh_bala wrote:
Please revert back with an clear unix commend to be used.
What, is that an order? and by the way, this is not a unix forum.

Try : sort -u :evil: :evil: :evil:
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

Its not the right one.
before posting, Please check and post. :twisted: :twisted: :twisted: :twisted: :twisted:
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It IS the right one.

The -u option for the sort command means "unique" - it returns unique values of the sort keys.

Therefore, if it is not giving you the answer you require, then you are not specifying the sort command appropriately.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

Sort -u, It only sorts the values.
But it didn't eliminate the duplicate values.
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

You need to specify appropriate key values while removing duplicates. Refer man pages for help.
sud
Premium Member
Premium Member
Posts: 366
Joined: Fri Dec 02, 2005 5:00 am
Location: Here I Am

Post by sud »

Magesh_bala wrote:Its not the right one.
before posting, Please check and post. :twisted: :twisted: :twisted: :twisted: :twisted:
:roll:
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

Some one can help to resolve this problem.
bkumar103
Participant
Posts: 214
Joined: Wed Jul 25, 2007 2:29 am
Location: Chennai

Post by bkumar103 »

Magesh_bala
before arguing please check the option.
Sort -u sorts and returns the unique records. Only thing is duplicate removal will be on the record basis not of the field baseis.

For example :

original file
abc xyz
abc xyz
xyz abc
lmn abc
lmn fgh

sort -u file will return
abc xyz
lmn abc
lmn fgh
xyz abc

If your requirement is different state it clearly.
Birendra
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

Thanks Kumar, I thought its removes duplicate in column level.
Thank you .
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

Hey Dude, Its not working!!! I have checked it.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

"It's not working" is singularly uninformative.

If you want us to help you need to specify the actual command(s) that you used, what you expected to get, what you actually got, and why you believe that they are different.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

why don;t you google for "unix unique record sorting"
and try those options
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

Hi My Source File
11|Anil |99|MIG |POLIC|Motor
12|Guna |66|MI |OBJEC|Home
11|baba |23|MIG |POLIC|Motor
13|Ji |77|MM |cover|Tata
11|Anil |99|MIG |POLIC|Motor
14|qqq |77|QQ |Objec|MIG
22|aaa |99|aa |Gate |zz

I have used sort -u file_name.txt to eliminate duplicate records
But I am not getting the expected result
My output
11|Anil |99|MIG |POLIC|Motor
11|Anil |99|MIG |POLIC|Motor
11|baba |23|MIG |POLIC|Motor
12|Guna |66|MI |OBJEC|Home
13|Ji |77|MM |cover|Tata
14|qqq |77|QQ |Objec|MIG
22|aaa |99|aa |Gate |zz

Expected result

11|Anil |99|MIG |POLIC|Motor
11|baba |23|MIG |POLIC|Motor
12|Guna |66|MI |OBJEC|Home
13|Ji |77|MM |cover|Tata
14|qqq |77|QQ |Objec|MIG
22|aaa |99|aa |Gate |zz

help me!!! to resolve these problem.
yiminghu
Participant
Posts: 91
Joined: Fri Nov 14, 2003 10:09 am

Post by yiminghu »

Use following command
sort -u filename|uniq

Sort does not get rid of duplicate records, it only sort the file, uniq does the trick.
Post Reply