[Bioperl-l] deleting string fragments?

James Wasmuth james.wasmuth at ed.ac.uk
Thu Apr 1 05:03:32 EST 2004


Hi Gyoergy

the regex is s/-dfg//g;

this says substitute the string '-dfg' with nothing.

check out 'perldoc perlre'

-james



Gyoergy Abrusan wrote:

> Dear All,
>
> I would like to ask whether there is a command that deletes a certain 
> fragment of a sring.
>
> what I mean is:
> eg. I have stings like
>
> adfdfgfgg-dfgdfmgfgfgfg
>
> I would like to remove -dfg and print out only
>
> adfdfgfggdfmgfgfgfg
>
> Is there a commad (something similar to chop)that removes an arbitrary 
> substring from a string (the place of the target sequences is alvays 
> different)?
>
> eg.:
>
> open (OUT, ">RESULTS.txt")
>
> while(<>)
> {
> if ($_=~ /-dfg/g)
>     {cut out -dfg  ???
>      print OUT "$_";}
>
> else
>     {print OUT "$_";}
> }
> close OUT;
>
>
> I would greatly appreciate any help.
> Thanking you in advance.
>
> Best,
>
> Gyorgy Abrusan
>
>
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l


-- 
"I have not failed. I've just found 10,000 ways that don't work."
               --- Thomas Edison

Nematode Bioinformatics          |
Blaxter Nematode Genomics Group  |
School of Biological Sciences    |
Ashworth Laboratories            | tel: +44 131 650 7403
University of Edinburgh          | web: www.nematodes.org
Edinburgh                        |
EH9 3JT                          |
UK                               |	



More information about the Bioperl-l mailing list