Re: Sorting CSV string and removing Duplicates

From: Yves Dorfsman <yves(at)zioup(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting CSV string and removing Duplicates
Date: 2015-07-27 20:00:15
Message-ID: 55B68DCF.3030603@zioup.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> I have a csv string in a text field that is unsorted and contains duplicates.
> Is there a simple way to remove these and sort the string.
>
> E.g
> 2,18,20,23,1,27,1,2,8,16,17,18,20,22,23,27
>

Do you need to eventually load the data in Postgres?

I'd personally use python to deal with this, we're talking 4 or 5 lines here,
if even. I suspect you can do the same with perl or ruby or whatever is your
weapon of choice.

How columns does your csv file has? Is it a one-line file?

--
http://yves.zioup.com
gpg: 4096R/32B0F416

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Mair 2015-07-27 20:01:58 Re: Sorting CSV string and removing Duplicates
Previous Message dinesh kumar 2015-07-27 19:57:02 Re: Sorting CSV string and removing Duplicates