Friday, January 12, 2018

Convert DOS to UNIX file type: eliminate ^M at the end of the line

To convert DOS with ^M at the end of the line to UNIX file types,


tissue_site_detail      tissue_site_detail_abbr tissue_site_detail_id   tissue_site     tissue_color_hex        tissue_color_rgb^MAdipose - Subcutaneous        ADPSBQ  Adipose_Subcutaneous    Adipose Tissue  FF6600  "255,102,0"^MAdipose - Visceral (Omentum)       ADPVSC  Adipose_Visceral_Omentum        Adipose Tissue  FFAA00  "255,170,0"^MAdrenal Gland      ADRNLG  Adrenal_Gland   Adrenal Gland   33DD33  "51,221,51"^MArtery - Aorta     ARTAORT Artery_Aorta    Blood Vessel    FF5555  "255,85,85"^MArtery - Coronary  ARTCRN  Artery_Coronary Blood Vessel    FFAA99  "255,170,153"^MArtery - Tibial  ARTTBL  Artery_Tibial   Blood Vessel    FF0000  "255,0,0"^MBladder      BLDDER  Bladder Bladder AA0000  "170,0,0"^MBrain - Amygdala     BRNAMY  Brain_Amygdala  Brain   EEEE00  

Use sed command:

sed -i "s/^M/\n/g" gtex_tissue_colors.txt
Be sure to enter ^M, with CTRL-V CTRL-M.

tissue_site_detail      tissue_site_detail_abbr tissue_site_detail_id   tissue_site     tissue_color_hex        tissue_color_rgb
Adipose - Subcutaneous  ADPSBQ  Adipose_Subcutaneous    Adipose Tissue  FF6600  "255,102,0"
Adipose - Visceral (Omentum)    ADPVSC  Adipose_Visceral_Omentum        Adipose Tissue  FFAA00  "255,170,0"
Adrenal Gland   ADRNLG  Adrenal_Gland   Adrenal Gland   33DD33  "51,221,51"
Artery - Aorta  ARTAORT Artery_Aorta    Blood Vessel    FF5555  "255,85,85"
Artery - Coronary       ARTCRN  Artery_Coronary Blood Vessel    FFAA99  "255,170,153"
Artery - Tibial ARTTBL  Artery_Tibial   Blood Vessel    FF0000  "255,0,0"
Bladder BLDDER  Bladder Bladder AA0000  "170,0,0"
Brain - Amygdala        BRNAMY  Brain_Amygdala  Brain   EEEE00  "238,238,0"
"238,238,0"

No comments:

Post a Comment