<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Commands to Remove White Space In Text Or String Using Awk And Sed In Linux]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/43395/commands-to-remove-white-space-in-text-or-string-using-awk-and-sed-in-linux?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/43395/commands-to-remove-white-space-in-text-or-string-using-awk-and-sed-in-linux?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/43395/commands-to-remove-white-space-in-text-or-string-using-awk-and-sed-in-linux</guid>
	<pubDate>Wed, 22 Sep 2021 08:01:34 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/43395/commands-to-remove-white-space-in-text-or-string-using-awk-and-sed-in-linux</link>
	<title><![CDATA[Commands to Remove White Space In Text Or String Using Awk And Sed In Linux]]></title>
	<description><![CDATA[<code>text=&quot; ATGGTV AGTGACCTAGAGTGATGA G   GGRTTT&quot;

echo &quot;$text&quot; | sed &#039;s/ //g&#039;
OR
echo &quot;$text&quot; | awk &#039;{ gsub(/ /,&quot;&quot;); print }&#039;

Return: ATGGTVAGTGACCTAGAGTGATGAGGGRTTT

echo &quot;$text&quot; | sed &#039;s/^ //g&#039;

echo &quot;$text&quot; | sed &#039;s/ \$//g&#039;

#Multiple space
cat /tmp/test.txt | sed &#039;s/[ ]\+/ /g&#039;

echo &quot;$text1&quot; | awk &#039;{ gsub(/[ ]+/,&quot; &quot;); print }&#039;

cat /tmp/test.txt | awk &#039;{ gsub(/[ ]+/,&quot; &quot;); print }&#039;</code>]]></description>
	<dc:creator>Neel</dc:creator>
</item>

</channel>
</rss>