<?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 Re: need to retain white space in shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380053#M682000</link>
    <description>Hi,&lt;BR /&gt;[root@rspc521 suraj]# cat o&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;string="123   "&lt;BR /&gt;echo "$string"&lt;BR /&gt;[root@rspc521 suraj]# sh o &amp;gt;oo&lt;BR /&gt;[root@rspc521 suraj]# cat oo&lt;BR /&gt;123&lt;BR /&gt;[root@rspc521 suraj]#&lt;BR /&gt;&lt;BR /&gt;in the above output you can see the output of oo is 123 but if you open file oo and give the command :se list then you can see the space after 123.&lt;BR /&gt;&lt;BR /&gt;Suraj</description>
    <pubDate>Mon, 20 Apr 2009 04:45:08 GMT</pubDate>
    <dc:creator>Suraj K Sankari</dc:creator>
    <dc:date>2009-04-20T04:45:08Z</dc:date>
    <item>
      <title>need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380043#M681990</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I don't want to loose "white space" which is suffix of any string but when i am doing echo, i loose those white spaces. Can anyone help me in this regard? Example&lt;BR /&gt;&lt;BR /&gt;#!/bin/perl&lt;BR /&gt;string="123                "&lt;BR /&gt;echo "$string"&lt;BR /&gt;&lt;BR /&gt;Output :&lt;BR /&gt;&lt;BR /&gt;123  ## white spaces get removed&lt;BR /&gt;&lt;BR /&gt;required output&lt;BR /&gt;&lt;BR /&gt;123                 ##which contains spaces as well.&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Mar 2009 13:04:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380043#M681990</guid>
      <dc:creator>nishant_4</dc:creator>
      <dc:date>2009-03-16T13:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380044#M681991</link>
      <description>This is a perl script, not a shell script.  Can yo ube more specific about your problem?  IN this example there is one space in the string "123 ".  You get this output correctly.  I dont understand what you mean by the # since that is not in the string. &lt;BR /&gt;&lt;BR /&gt;You may also try using print instead of echo, but both should yield the same result and that is the exact string you input, including spaces.&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Mar 2009 14:15:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380044#M681991</guid>
      <dc:creator>Cody Marcel</dc:creator>
      <dc:date>2009-03-16T14:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380045#M681992</link>
      <description>sorry for writing perl.....i don't know space after "123" get deleted although i mentioned it.&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;string="123               "&lt;BR /&gt;echo "$string"&lt;BR /&gt;&lt;BR /&gt;Output is :&lt;BR /&gt;&lt;BR /&gt;123&lt;BR /&gt;in above output white-spaces get trimmed automatically.&lt;BR /&gt;&lt;BR /&gt;But Required O/P should be :&lt;BR /&gt;&lt;BR /&gt;123(with white space)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Mar 2009 17:44:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380045#M681992</guid>
      <dc:creator>nishant_4</dc:creator>
      <dc:date>2009-03-16T17:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380046#M681993</link>
      <description>&lt;BR /&gt;white-space also trimmed in this forum......please consider "dot"(.) as white space and then realize my problem.&lt;BR /&gt;&lt;BR /&gt;Suppose "Dot"as white-space&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;string="123....................."&lt;BR /&gt;echo "$string"&lt;BR /&gt;&lt;BR /&gt;Output is :&lt;BR /&gt;&lt;BR /&gt;123&lt;BR /&gt;in above output white-spaces get trimmed automatically.&lt;BR /&gt;&lt;BR /&gt;But Required O/P should be :&lt;BR /&gt;&lt;BR /&gt;123.......................</description>
      <pubDate>Mon, 16 Mar 2009 17:48:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380046#M681993</guid>
      <dc:creator>nishant_4</dc:creator>
      <dc:date>2009-03-16T17:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380047#M681994</link>
      <description>First you wrote a perl script, then you wrote a korn shell script :-)... but I am still confused as to why this question is posted here.... !! This question would need to go to the HP-UX forum.... In VB you have the Space() function to add spaces to a string....</description>
      <pubDate>Mon, 16 Mar 2009 17:56:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380047#M681994</guid>
      <dc:creator>Reju George</dc:creator>
      <dc:date>2009-03-16T17:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380048#M681995</link>
      <description>leave shell or perl script behind.......come to unix command.&lt;BR /&gt;&lt;BR /&gt;consider "Dot" as white-space&lt;BR /&gt;&lt;BR /&gt;$echo "123......................."&lt;BR /&gt;123&lt;BR /&gt;$&lt;BR /&gt;(above is the o/p of command)&lt;BR /&gt;&lt;BR /&gt;But i want output with "white-spaces" how can i achieve it?</description>
      <pubDate>Mon, 16 Mar 2009 18:11:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380048#M681995</guid>
      <dc:creator>nishant_4</dc:creator>
      <dc:date>2009-03-16T18:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380049#M681996</link>
      <description>The whitespace is there, you just cannot see it.  If anything it is the terminal that is not displaying the text. Do this...&lt;BR /&gt;&lt;BR /&gt;$ echo '123   1   ' &amp;gt; t.txt&lt;BR /&gt;&lt;BR /&gt;Then open t.txt in an editor like vi.  You will see that the trailing spaces are in fact there.</description>
      <pubDate>Mon, 16 Mar 2009 18:46:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380049#M681996</guid>
      <dc:creator>Cody Marcel</dc:creator>
      <dc:date>2009-03-16T18:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380050#M681997</link>
      <description>Use print instead&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;string="123        "&lt;BR /&gt;string2="   456"&lt;BR /&gt;print "$string$string2"&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Mar 2009 12:22:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380050#M681997</guid>
      <dc:creator>Percy Bell</dc:creator>
      <dc:date>2009-03-25T12:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380051#M681998</link>
      <description>Looking at the examples that work the key is to quote the echo/print line.&lt;BR /&gt;&lt;BR /&gt;If you use echo "$c" your script should work.</description>
      <pubDate>Wed, 25 Mar 2009 12:24:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380051#M681998</guid>
      <dc:creator>Percy Bell</dc:creator>
      <dc:date>2009-03-25T12:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380052#M681999</link>
      <description>From man&lt;BR /&gt;&lt;BR /&gt;`echo' writes each given STRING to standard output, with a space&lt;BR /&gt;between each and a newline after the last one.&lt;BR /&gt;&lt;BR /&gt;So does not matter how many white space you give in echo it would be reduced to one white space between characters , and for only one contunoius string...all white space after character would vanish"&lt;BR /&gt;This is what echo do.&lt;BR /&gt;&lt;BR /&gt;If you want to have echo do as said above.&lt;BR /&gt;echo "$string"&lt;BR /&gt;put $string in quotes.&lt;BR /&gt;&lt;BR /&gt;BR,&lt;BR /&gt;Kapil+</description>
      <pubDate>Mon, 20 Apr 2009 04:43:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380052#M681999</guid>
      <dc:creator>Kapil Jha</dc:creator>
      <dc:date>2009-04-20T04:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: need to retain white space in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380053#M682000</link>
      <description>Hi,&lt;BR /&gt;[root@rspc521 suraj]# cat o&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;string="123   "&lt;BR /&gt;echo "$string"&lt;BR /&gt;[root@rspc521 suraj]# sh o &amp;gt;oo&lt;BR /&gt;[root@rspc521 suraj]# cat oo&lt;BR /&gt;123&lt;BR /&gt;[root@rspc521 suraj]#&lt;BR /&gt;&lt;BR /&gt;in the above output you can see the output of oo is 123 but if you open file oo and give the command :se list then you can see the space after 123.&lt;BR /&gt;&lt;BR /&gt;Suraj</description>
      <pubDate>Mon, 20 Apr 2009 04:45:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-retain-white-space-in-shell-script/m-p/4380053#M682000</guid>
      <dc:creator>Suraj K Sankari</dc:creator>
      <dc:date>2009-04-20T04:45:08Z</dc:date>
    </item>
  </channel>
</rss>

