sm-users AT lists.ibiblio.org
Subject: Sourcemage Users List
List archive
- From: Seth Woolley <seth AT tautology.org>
- To: Treeve Jelbert <treeve01 AT pi.be>
- Cc: sm-users AT lists.ibiblio.org
- Subject: Re: [SM-Users] sed problem
- Date: Thu, 2 Oct 2003 10:32:01 -0700 (PDT)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
$ echo 3.1.2asfsd3.1.3sdfds3.1.92afdsfafadsf3.1.93 | sed -e
's/3\.[012]\.[0-9][0-9]\?/xx/g'
xxasfsdxxsdfdsxxafdsfafadsfxx
the \? metacharacter means optional (zero or one count) for the previous
entity.
dots represent "any char" and thus need to be escaped to be literal.
at least, in non-extended regular expressions (slightly different for
extended regular expressions).
Seth
man 7 regex may help.
On Thu, 2 Oct 2003, Treeve Jelbert wrote:
> I need to convert strings containing 3.1.2 or 3.1.92 to xx
>
> I tried
>
> sed "s:3.[012].[0-9]:xx:"
> and
> sed "s:3.[012].[0-9][0-9]:xx:"
>
> but can't make it handle both cases, so that the last digit is optional
>
> any suggestions?
>
> Regards, Treeve
>
> --
> PGP Key ID: AB929B24
> PGP Key Fingerprint:31D9 D22F 42E6 F545 662E AB6F 9697 34C5 AB92 9B24
> _______________________________________________
> SM-Users mailing list
> SM-Users AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/sm-users
>
> ------------ Output from gpg ------------
> gpg: WARNING: using insecure memory!
> gpg: please see http://www.gnupg.org/faq.html for more information
> gpg: Signature made Thu Oct 2 10:03:39 2003 PDT using DSA key ID AB929B24
> gpg: Good signature from "Treeve Jelbert <treeve AT pi.be>"
> gpg: WARNING: This key is not certified with a trusted signature!
> gpg: There is no indication that the signature belongs to the
> owner.
> Primary key fingerprint: 31D9 D22F 42E6 F545 662E AB6F 9697 34C5 AB92 9B24
>
>
- --
Seth Alan Woolley <seth at tautology.org>, SPAM/UCE is unauthorized
Key id 7BEACC7D = 2978 0BD1 BA48 B671 C1EB 93F7 EDF4 3CDF 7BEA CC7D
Full Key at seth.tautology.org and pgp.mit.edu. info: www.gnupg.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)
iD8DBQE/fGEW7fQ833vqzH0RAgq7AKCen+QAmNokiGs96p/nJhHtuJV5ZgCeOo1G
tleeQaKhS2gxgCcQhgS6cF8=
=FNx7
-----END PGP SIGNATURE-----
-
[SM-Users] sed problem,
Treeve Jelbert, 10/02/2003
- Re: [SM-Users] sed problem, Seth Woolley, 10/02/2003
Archive powered by MHonArc 2.6.24.