X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 968CE52A2E for ; Wed, 23 Mar 2005 18:52:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83031-10 for ; Wed, 23 Mar 2005 18:52:23 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.183]) by svr1.postgresql.org (Postfix) with ESMTP id 2D70B5348A for ; Wed, 23 Mar 2005 18:52:22 +0000 (GMT) Received: from [212.227.126.205] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1DEAxq-00007d-00 for pgsql-sql@postgresql.org; Wed, 23 Mar 2005 19:52:22 +0100 Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1DEAxp-00025P-00 for pgsql-sql@postgresql.org; Wed, 23 Mar 2005 19:52:22 +0100 Received: from kretschmer by webserv.wug.de with local (Exim 3.35 #1) id 1DEAy3-0001GA-00 for pgsql-sql@postgresql.org; Wed, 23 Mar 2005 19:52:35 +0100 Date: Wed, 23 Mar 2005 19:52:35 +0100 From: Andreas Kretschmer To: pgsql-sql@postgresql.org Subject: Re: [despammed] How do I do this? Message-ID: <20050323185235.GC1271@webserv.wug-glas.de> Mail-Followup-To: Andreas Kretschmer , pgsql-sql@postgresql.org References: <4241A972.6040103@kencast.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4241A972.6040103@kencast.com> X-DEST: 208 X-MSMail-Priority: High X-Message-Flag: The Windows platform is not just insecure - it's patently, blatantly, and unashamedly insecure by design. X-PrivatMail: kretschmer@kaufbach.delug.de X-OS: Linux - weil ich es mir Wert bin! X-Info: registrierter Linux-User 97922 http://counter.li.org User-Agent: mutt-ng 1.5.9i (Linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.371 tagged_above=0 required=5 tests=AWL, MISSING_MIMEOLE, X_MSMAIL_PRIORITY_HIGH X-Spam-Level: X-Archive-Number: 200503/318 X-Sequence-Number: 20797 am 23.03.2005, um 12:37:54 -0500 mailte Wei Weng folgendes: > I have a table with column filepath with contents that look like the > following: > > filepath > ============== > /var/log/foo > /var/log/bar > /var/cache/foo > /var/cache/bar > /var/foo > /var/bar > > Is there anyway to retrieve the directory information only regarding those > filepaths? > > So that I can get > > /var/log > /var/cache > /var > test_db=# select * from filepath ; path ---------------- /var/log/foo /var/log/bar /var/cache/foo /var/cache/bar /var/foo (5 Zeilen) test_db=# select substring (path, '/.*/') from filepath ; substring ------------- /var/log/ /var/log/ /var/cache/ /var/cache/ /var/ (5 Zeilen) test_db=# select trim(trailing '/'from substring (path, '/.*/')) from filepath ; rtrim ------------ /var/log /var/log /var/cache /var/cache /var (5 Zeilen) test_db=# select version(); version ------------------------------------------------------------------------------------------------------ PostgreSQL 7.4.7 on i386-pc-linux-gnu, compiled by GCC i386-linux-gcc (GCC) 3.3.5 (Debian 1:3.3.5-5) (1 Zeile) Regards, Andreas -- Andreas Kretschmer (Kontakt: siehe Header) Heynitz: 035242/47212, D1: 0160/7141639 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net === Schollglas Unternehmensgruppe ===