Hi all. I need a little bit of help.
I have a list of files in a folder, they look like this:

       H3K4me1/Cell-Line=S2-DRSC#Developmental-Stage=Late-Embryonic-stage#Tissue=Embryo-derived-cell-line/ChIP-chip/Rep-1//Dmel_r5.32/modENCODE_304.gff3
    
    H3K4me2/Cell-Line=S2-DRSC#Developmental-Stage=Late-Embryonic-stage#Tissue=Embryo-derived-cell-line/ChIP-chip/Rep-1//Dmel_r5.32/modENCODE_965.gff3
    
    H3K4me3/Cell-Line=S2-DRSC#Developmental-Stage=Late-Embryonic-stage#Tissue=Embryo-derived-cell-line/ChIP-chip/Rep-1//Dmel_r5.32/modENCODE_3761.gff3
    
    H3K9ac/Cell-Line=S2-DRSC#Developmental-Stage=Late-Embryonic-stage#Tissue=Embryo-derived-cell-line/ChIP-chip/Rep-1//Dmel_r5.32/modENCODE_3765.gff3

I would like to change their name with sed command, so the final name would be like this:

    H3K4me1_modENCODE_304.gff3
    
    H3K4me2_modENCODE_965.gff3
    
    H3K4me3_modENCODE_3761.gff3
    
    H3K9ac_modENCODE_3765.gff3

I know i can play with `sed s` and the `/` but I don't manage to get it to work. I would extremely appreciate if you explain a bit the code you give as an answer.

Thank you in advance! 
Best wishes,

Jordi 
This is all you need in terms of an expression:

    sed 's|/.*/|_|gi'

e.g.

    $ echo "H3K4me1/Cell-Line=S2-DRSC#Developmental-Stage=Late-Embryonic-stage#Tissue=Embryo-derived-cell-line/ChIP-chip/Rep-1//Dmel_r5.32/modENCODE_304.gff3" | sed 's|/.*/|_|gi'
    H3K4me1_modENCODE_304.gff3

Pro tip, use that regular expression with the `rename` program.

Explained:

`s` = substitute

`|` = sed delimiter so as to avoid confusion with the more traditional `/`

`/` = Match the first forward slash you find

`.*` = followed by any character, any number of times

`/` = until you meet another `/`.

`|_|` = replace all the previously matched stuff with an underscore.

`gi` = globally, and case insensitive (you don't strictly need these, I include them as force of habit).