Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • syintel87
    replied
    Dear jummyybee and BAMseek,

    Thank you so much!!!

    Leave a comment:


  • BAMseek
    replied
    Just in case there is another ":" on that line, and you don't want to be too greedy, you might try the more conservative

    Code:
    sed 's/Mh\:[0-3][0-4][0-5][0-1]\://' file

    Leave a comment:


  • jimmybee
    replied
    Looks like your way is ok but you need to escape the colons. This might not be the most elegant way of doing it (im far from a expert in sed and awk) but

    Code:
    sed 's/Mh\:.*\://' file > new_file
    Basically it searches for Mh:####: and removes it to leave the second "Mh"

    Hope that helps

    Leave a comment:


  • syintel87
    replied
    Originally posted by jimmybee View Post
    Sorry but its not really clear what you want to search and replace. Can you give us an example of a line you want to achieve?
    Sorry for making you confused.

    My files look like the following:
    FA file >Mh:0000:MhA1_Contig0AGTTGTTAATTTTTC
    GFF file Mh:0000:MhA1_Contig0 Freeze3 mRNA 4027 5970 + ID=MhA1

    My goal is to make these files look like the following:
    FA file >MhA1_Contig0AGTTGTTAATTTTTC
    GFF file MhA1_Contig0 Freeze3 mRNA 4027 5970 + ID=MhA1

    In other words, I will have to
    - replace Mh:0000:Mh by Mh
    - or delete Mh:0000:
    - or delete :0000:Mh

    Regardless of what numbers are in between Mh's, only "Mh" should be remained. In other words, the pattern Mh:####:Mh, where #### varies from 0000 to 3451, has to be reduced to "Mh".

    I hope my description does make sense.
    Thank you in advance for sparing your precious time.
    Last edited by syintel87; 01-02-2013, 08:32 PM.

    Leave a comment:


  • jimmybee
    replied
    Sorry but its not really clear what you want to search and replace. Can you give us an example of a line you want to achieve?

    Leave a comment:


  • syintel87
    started a topic Character replacement of Textfile

    Character replacement of Textfile

    I'd like to replace "Mh:####:Mh" by "Mh" in a text file,
    where #### ranges from 0000 to 3451.

    Would you give me some tips how to use sed command to achieve this goal?

    For example, when I ran one command, sed 's/Mh/m/' Mh.txt > Mh_tr.txt, it worked.
    However, not only when there are combination of special characters with numbers, but also when there exists a numerical variable, I have no idea about this.

    Thank you in advance.

Latest Articles

Collapse

  • SEQadmin2
    Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
    by SEQadmin2



    Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

    Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
    ...
    10-14-2026, 09:55 AM

ad_right_rmr

Collapse

News

Collapse

Topics Statistics Last Post
Started by SEQadmin2, 10-28-2026, 09:57 AM
0 responses
22 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, 10-28-2026, 09:51 AM
0 responses
14 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, 10-22-2026, 11:13 AM
0 responses
67 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, 10-22-2026, 10:48 AM
0 responses
47 views
0 reactions
Last Post SEQadmin2  
Working...