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
every time you put a '#' or a '=' in a filename, god kills a kitten.
got them named like this from modENCODE page, but thanks for the information, never will dare to do it (poor kittens!)
Just be a little cautious with all the
/
's in those names. That'll look like a directory structure to bash.e.g.
touch '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'
fails miserably, even when hard quoted.+1 Pierre
Then we have the culprit for wars and famines: spaces in filenames.