Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




  • BioScripts
  • Neel
  • Commands to Remove White Space In Text Or String Using Awk And Sed In Linux

Commands to Remove White Space In Text Or String Using Awk And Sed In Linux

  • Public
By Neel 1157 days ago
text=" ATGGTV AGTGACCTAGAGTGATGA G GGRTTT" echo "$text" | sed 's/ //g' OR echo "$text" | awk '{ gsub(/ /,""); print }' Return: ATGGTVAGTGACCTAGAGTGATGAGGGRTTT echo "$text" | sed 's/^ //g' echo "$text" | sed 's/ \$//g' #Multiple space cat /tmp/test.txt | sed 's/[ ]\+/ /g' echo "$text1" | awk '{ gsub(/[ ]+/," "); print }' cat /tmp/test.txt | awk '{ gsub(/[ ]+/," "); print }'