Daca e vorba doar de primul match poti face ceva de genul:
update _table_ set path=overlay(path placing '/new_path/' from
position('path' in path) for length('path'));

http://www.postgresql.org/docs/current/interactive/functions-string.html

dar problema se complica daca ai vrea sa faci match pe un anume
substring. Sa zicem ca in path iti apare de 3 ori '/etc/' si vrei sa 
il modifici doar pe al doilea...???


On Thu, 2004-01-22 at 13:58, Patrascu Eugeniu wrote:
> multumesc fain. face exact ceea ce vroiam eu sa faca.
> ca idee // face match oriunde in text, exista vreo optiune la replace sa
> fac match doar dupa some/ si pana la urmatorul / ?
> adica daca am path de mai multe ori in campul respectiv sa-mi faca match
> doar pe primul ?
> 
> ps: multumesc si celorlalti care mi-au raspuns.
> 
> On Thu, 2004-01-22 at 13:45, Alex Crivat wrote:
> > update _tabel_ set path=replace(path, '/path/', '/new_path/');
> > 
> > On Thu, 2004-01-22 at 12:28, Patrascu Eugeniu wrote:
> > > salut,
> > > intr-un postgres am un tabel cu capuri de de felul:
> > > 
> > >  Column |       Type        | Modifiers 
> > > --------+-------------------+-----------
> > >  id     | numeric           | 
> > >  path   | character varying | 
> > > 
> > > 
> > > iar in tabel am inregistrari de genul:
> > > 
> > > 
> > >  id |          path          
> > > ----+------------------------
> > >   1 | some/path/some_file
> > >   2 | some/path/another_file
> > > (2 rows)
> > > 
> > > 
> > > problema e ca trebuie sa modific path-ul. astfel incat de
> > > "some/path/some_file" sa am "some/new_path/some_file". stiu ca pgsql
> > > stie de regular expressions si as vrea sa stiu care este echivalentul in
> > > postgresql pentru un statement UPDATE pentru a realiza ce se face in sed
> > > ~$ echo "/some/path/some_file" | sed -e "s/path/new_path/"
> > >    /some/new_path/some_file
> > > 
> > > tia,
-- 
Alex Crivat

WWW: http://axu.rdsnet.ro
GPG: http://axu.rdsnet.ro/pgp.txt
e-Mail: [EMAIL PROTECTED]
____________________________________
Open source -> Millions of opened minds can't be wrong

-- Attached file included as plaintext by Ecartis --
-- File: signature.asc
-- Desc: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iQEVAwUAQA/CVsfDzXQDxJGXAQJZtAf9FvZrSJ5aDpqQLJ/JdAC2naiTgxlLO79F
aAcIDdf1r3WOZ3B/G+wtktQE9oud3vHTI4UweyYy4qruvv2JkbP/9Fbweqh/Ol3G
pNkQY6M2ekFh8opuZUcsDu1P6kCnx0PrLnwJTDgo5BUpX9TKksiS25ZfIwfcwiUp
7cS03U7DgXg4Jkjpc2aoQsW10uhjJ1QQmmugcHhU9hNo8MwA3Ux2vzqubfx9v0KT
0TI4Iwp7e5FAsdEgTGOvRm2wo+UOpNf4eKjRs/ByD14oOK1qidZUgKzGHeVzU0Ck
pBEhyBKUCmo/Q6tHlbbaQ//8grYFdqGlsvJlUaTjgvCrZJRbUJ/kGQ==
=LtFk
-----END PGP SIGNATURE-----



--- 
Detalii despre listele noastre de mail: http://www.lug.ro/


Raspunde prin e-mail lui