<?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: Formatting File in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441012#M768894</link>
    <description>With tr and the -s option the second argument is not needed.&lt;BR /&gt;&lt;BR /&gt;echo "aaa         bbb         ccc"  yeilds &lt;BR /&gt;aaa         bbb         ccc&lt;BR /&gt;echo "aaa         bbb         ccc" | tr -s " " yeilds&lt;BR /&gt;aaa bbb ccc</description>
    <pubDate>Tue, 29 Aug 2000 17:58:25 GMT</pubDate>
    <dc:creator>Leslie Chaim</dc:creator>
    <dc:date>2000-08-29T17:58:25Z</dc:date>
    <item>
      <title>Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441009#M768891</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I have an ASCII flat file which has a lot of white space ( spaces ) in between the fields.  The field separators are quoted comma ( "," ).  How can I remove these spaces between the field separators using something like sed, awk or tr?&lt;BR /&gt;A specific example or answer would be nice.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Sanjay.</description>
      <pubDate>Tue, 29 Aug 2000 17:38:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441009#M768891</guid>
      <dc:creator>Sanjay Tailor</dc:creator>
      <dc:date>2000-08-29T17:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441010#M768892</link>
      <description>Sanjay:&lt;BR /&gt;&lt;BR /&gt;You can "squeeze" multiple blanks down to one with 'tr'.  For example"&lt;BR /&gt;&lt;BR /&gt;# echo "xxx    yyy     zzz"|tr -s " " " "&lt;BR /&gt;&lt;BR /&gt;yields "xxx yyy zzz"&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 29 Aug 2000 17:47:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441010#M768892</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2000-08-29T17:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441011#M768893</link>
      <description>I use the following to remove the tilde ~ sign at the end of each ascii row:&lt;BR /&gt;&lt;BR /&gt;sed "s/~$//p" INFILE &amp;gt; OUTFILE</description>
      <pubDate>Tue, 29 Aug 2000 17:49:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441011#M768893</guid>
      <dc:creator>Tracey</dc:creator>
      <dc:date>2000-08-29T17:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441012#M768894</link>
      <description>With tr and the -s option the second argument is not needed.&lt;BR /&gt;&lt;BR /&gt;echo "aaa         bbb         ccc"  yeilds &lt;BR /&gt;aaa         bbb         ccc&lt;BR /&gt;echo "aaa         bbb         ccc" | tr -s " " yeilds&lt;BR /&gt;aaa bbb ccc</description>
      <pubDate>Tue, 29 Aug 2000 17:58:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441012#M768894</guid>
      <dc:creator>Leslie Chaim</dc:creator>
      <dc:date>2000-08-29T17:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441013#M768895</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;Can you attach a small file so that we can get you the right solution.</description>
      <pubDate>Tue, 29 Aug 2000 18:26:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441013#M768895</guid>
      <dc:creator>Vikas Khator</dc:creator>
      <dc:date>2000-08-29T18:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441014#M768896</link>
      <description>Sanjay, so you have a file called FILE1 with strings that look like this:&lt;BR /&gt;&lt;BR /&gt;field1   ","     field2   ","    field3   ","    filed4   &lt;BR /&gt;&lt;BR /&gt;You can use the command:&lt;BR /&gt;&lt;BR /&gt;sed 's/ //g' FILE1&lt;BR /&gt;&lt;BR /&gt;to yeild the output:&lt;BR /&gt;&lt;BR /&gt;field1","field2","field3","filed4","&lt;BR /&gt;&lt;BR /&gt;Tony&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Aug 2000 18:40:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441014#M768896</guid>
      <dc:creator>Anthony deRito</dc:creator>
      <dc:date>2000-08-29T18:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441015#M768897</link>
      <description>Hello Anthony,&lt;BR /&gt;&lt;BR /&gt;With the suggestion from James, I got the fileds down form multiple to single spaces.  I tried what you suggested using sed and it did work.  Yet one of my fields is a title ( example "The Calculus Book."  When I ran sed it got rid of all the spaces including the one in the title.  Like I said my field separators are ","  My spaces are on either sides of these.  Can write something in sed to just take out the spaces here?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Sanjay.</description>
      <pubDate>Tue, 29 Aug 2000 18:47:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441015#M768897</guid>
      <dc:creator>Sanjay Tailor</dc:creator>
      <dc:date>2000-08-29T18:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441016#M768898</link>
      <description>try:&lt;BR /&gt;&lt;BR /&gt;sed 's/[ ]*,[ ]*/ , /g' t</description>
      <pubDate>Tue, 29 Aug 2000 18:56:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441016#M768898</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2000-08-29T18:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441017#M768899</link>
      <description>Or:&lt;BR /&gt;&lt;BR /&gt;sed 's/[ ]*,[ ]*/,/g' t&lt;BR /&gt;&lt;BR /&gt;if you want no spaces at all around the commas</description>
      <pubDate>Tue, 29 Aug 2000 18:57:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441017#M768899</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2000-08-29T18:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441018#M768900</link>
      <description>Sanjay,&lt;BR /&gt;&lt;BR /&gt;Try this&lt;BR /&gt;&lt;BR /&gt;sed -e 's/ *(",") */1/g'  inpfile &amp;gt; outfile</description>
      <pubDate>Tue, 29 Aug 2000 18:58:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441018#M768900</guid>
      <dc:creator>Leslie Chaim</dc:creator>
      <dc:date>2000-08-29T18:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441019#M768901</link>
      <description>Hmmm, I see the problem.  You would not want the spaces to go away in the title of the book.  Anyone else...&lt;BR /&gt;&lt;BR /&gt;Tony</description>
      <pubDate>Tue, 29 Aug 2000 18:59:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441019#M768901</guid>
      <dc:creator>Anthony deRito</dc:creator>
      <dc:date>2000-08-29T18:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting File</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441020#M768902</link>
      <description>Hello All,&lt;BR /&gt;&lt;BR /&gt;I tried what Anthony suggested and got the spaces removed everywhere.  I then tried:&lt;BR /&gt; sed 's/ "," /","/g' file1 &amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;And it worked!!!  This seems to be the format I am looking for.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;Sanjay.</description>
      <pubDate>Tue, 29 Aug 2000 19:06:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/formatting-file/m-p/2441020#M768902</guid>
      <dc:creator>Sanjay Tailor</dc:creator>
      <dc:date>2000-08-29T19:06:13Z</dc:date>
    </item>
  </channel>
</rss>

