<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic remove extra spaces in a string in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-extra-spaces-in-a-string/m-p/4157760#M726508</link>
    <description>Hello,&lt;BR /&gt;&lt;BR /&gt;i want to remove extra spaces in my string in unix. which command i need to use.&lt;BR /&gt;&lt;BR /&gt;Ex: i   am      rahul. this is the string now i want the result to be as : i am rahul&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Sat, 08 Mar 2008 06:26:19 GMT</pubDate>
    <dc:creator>manasa_1</dc:creator>
    <dc:date>2008-03-08T06:26:19Z</dc:date>
    <item>
      <title>remove extra spaces in a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-extra-spaces-in-a-string/m-p/4157760#M726508</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;i want to remove extra spaces in my string in unix. which command i need to use.&lt;BR /&gt;&lt;BR /&gt;Ex: i   am      rahul. this is the string now i want the result to be as : i am rahul&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 08 Mar 2008 06:26:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-extra-spaces-in-a-string/m-p/4157760#M726508</guid>
      <dc:creator>manasa_1</dc:creator>
      <dc:date>2008-03-08T06:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: remove extra spaces in a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-extra-spaces-in-a-string/m-p/4157761#M726509</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;it seems that you already have a similar thread at:&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1210930" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1210930&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;please check and let us know if the solutions provided are helpful.&lt;BR /&gt;&lt;BR /&gt;Otherwise, clarify your question further.&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Sat, 08 Mar 2008 07:10:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-extra-spaces-in-a-string/m-p/4157761#M726509</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-03-08T07:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: remove extra spaces in a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-extra-spaces-in-a-string/m-p/4157762#M726510</link>
      <description>&lt;!--!*#--&gt;manasa,&lt;BR /&gt;&lt;BR /&gt;Where is the string coming from / going to?&lt;BR /&gt;Is it in a file? a shell variable? what shell?&lt;BR /&gt;&lt;BR /&gt;What problem are you really trying to solve?&lt;BR /&gt;The answer to that question will help define the optimal answer to the part question you asked.&lt;BR /&gt;&lt;BR /&gt;If you choose to explain the problem better be sure to click 'Retain format(spacing). URLs will not be clickable' because as you see, the itrc forum mangled your entrie to loose teh cirtical example. In addition you may want to attach a .txt file with EXACT input examples and EXACT desired output.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Anyway... &lt;BR /&gt;If it is in a shell variable then just a simple print will 'clean it up' and we can use that:&lt;BR /&gt;&lt;BR /&gt;$ x='aap     noot      mies'&lt;BR /&gt;$ print "$x"&lt;BR /&gt;aap     noot      mies&lt;BR /&gt;$ print $x&lt;BR /&gt;aap noot mies&lt;BR /&gt;$ y=$(print $x)&lt;BR /&gt;$ print "x:$x.y:$y"&lt;BR /&gt;x:aap     noot      mies.y:aap noot mies&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;Or you can feed it to 'sed'&lt;BR /&gt;For example:&lt;BR /&gt;$ y=$(print "$x" | sed  's/  */*/g')&lt;BR /&gt;$ print "$y"&lt;BR /&gt;aap*noot*mies&lt;BR /&gt;&lt;BR /&gt;So the RE (regular expression) is to match a space, followed by zero or more spaces.&lt;BR /&gt;To be replaced in the example by *, but a space for you.&lt;BR /&gt;&lt;BR /&gt;spaces or white-space (tabs also)?&lt;BR /&gt;&lt;BR /&gt;Good luck,&lt;BR /&gt;Hein.</description>
      <pubDate>Sat, 08 Mar 2008 17:46:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-extra-spaces-in-a-string/m-p/4157762#M726510</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-03-08T17:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: remove extra spaces in a string</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-extra-spaces-in-a-string/m-p/4157763#M726511</link>
      <description>Hi,&lt;BR /&gt;tr -d " " &lt;BR /&gt;will remove all spaces in the string.&lt;BR /&gt;The use depends where you have your string: var, file, etc.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Mon, 10 Mar 2008 07:21:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-extra-spaces-in-a-string/m-p/4157763#M726511</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2008-03-10T07:21:38Z</dc:date>
    </item>
  </channel>
</rss>

