[nSLUG] sed question

Tony Abou-Assaleh taa at acm.org
Thu Dec 29 00:02:33 AST 2005


My vi doesn't seem to recognize .+, only .*. Also, you need a .* instead
of * at the end of the pattern. Further, your example has only one space
after EMAIL:, but your pattern has two \s.

The following pattern should work:

s/\(^EMAIL:\s.*\.com\).*/\1/g

Cheers,

TAA

-----------------------------------------------------
Tony Abou-Assaleh
Lecturer, Computer Science Department
Brock University, St. Catharines, ON, Canada, L2S 3A1
Office: MC J215
Tel:    +1(905)688-5550 ext. 5243
Fax:    +1(905)688-3255
Email:  taa at acm.org
WWW:    http://www.cosc.brocku.ca/~taa/
----------------------[THE END]----------------------

On Wed, 28 Dec 2005, Herb wrote:

> Hey all,
>
> Just learning the very basics of sed/regex while editing a large text
> file. I got a few of the easy edits done, but now I'm up against a
> couple of more complex ones. There are lines that have chunks that
> need removing while keeping other chunks.
>
> EMAIL: address at here remove these bits
>
> I've gotten as far as various permutations of this:
>
> sed  's/\(^EMAIL\:\s\s.+\.com\)*/\1/g' ctext3b > ctext3b_3
>
> but it's not working. The regex stuff does find what I need in the
> file but the removal isn't happening.
>
> Any help would be greatly appreciated :)
>
> Thanks,
>
> -Herb
>
>
> --
> --------
> Herb Theriault
> http://www.electronictea.com
>
>
>
> _______________________________________________
> nSLUG mailing list
> nSLUG at nslug.ns.ca
> http://nslug.ns.ca/cgi-bin/mailman/listinfo/nslug
>
> 
>

!DSPAM:43b35fdc272756198225953!




More information about the nSLUG mailing list