<?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: sed, ed, (hurts my head) in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780753#M77128</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;how about "unexpand" ???&lt;BR /&gt;see "man unexpand"&lt;BR /&gt;&lt;BR /&gt;good luck,&lt;BR /&gt;Thierry.</description>
    <pubDate>Tue, 06 Aug 2002 17:04:10 GMT</pubDate>
    <dc:creator>Thierry Poels_1</dc:creator>
    <dc:date>2002-08-06T17:04:10Z</dc:date>
    <item>
      <title>sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780749#M77124</link>
      <description>Greetings!&lt;BR /&gt;&lt;BR /&gt;I have a large text file and was wondering what the easiest way would be to replace "whitespace" between fields (words) with "tabs".  is this possible?  Each field in the file starts at a specific character position, but was hoping there was an easy way of just replacing whitespace with  a tab.&lt;BR /&gt;&lt;BR /&gt;Ideas? Suggestions?  Flames?&lt;BR /&gt;Thanks.</description>
      <pubDate>Tue, 06 Aug 2002 16:25:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780749#M77124</guid>
      <dc:creator>Ron Bombard</dc:creator>
      <dc:date>2002-08-06T16:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780750#M77125</link>
      <description>Well not sed but tr may do the trick :&lt;BR /&gt;cat &lt;FILENAME&gt; | tr " " "\t" &amp;gt; &lt;NEW filename=""&gt;&lt;BR /&gt;&lt;BR /&gt;ET voila&lt;BR /&gt;&lt;BR /&gt;Jean-Luc&lt;/NEW&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Tue, 06 Aug 2002 16:31:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780750#M77125</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2002-08-06T16:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780751#M77126</link>
      <description>Ron,&lt;BR /&gt;&lt;BR /&gt;Here's a couple of handy references to sed and awk commands, originally (to me, at least) courtesy of Princess Paula.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Tue, 06 Aug 2002 16:37:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780751#M77126</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2002-08-06T16:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780752#M77127</link>
      <description>And here's the awk one.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Tue, 06 Aug 2002 16:38:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780752#M77127</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2002-08-06T16:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780753#M77128</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;how about "unexpand" ???&lt;BR /&gt;see "man unexpand"&lt;BR /&gt;&lt;BR /&gt;good luck,&lt;BR /&gt;Thierry.</description>
      <pubDate>Tue, 06 Aug 2002 17:04:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780753#M77128</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2002-08-06T17:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780754#M77129</link>
      <description>I think I should have thought this through before posting...   The "unexpand" program works good, and the "tr" suggestions also works.  But....  all it takes is a blank field to screw it up.  If it runs into a blank field, instead of 2 tabs, there will be one.   &lt;BR /&gt;&lt;BR /&gt;I'm trying to load a text file into MySQL, and it has to be tab delimited.  And the original text file's field delimination is by ASCII Character Position.&lt;BR /&gt;&lt;BR /&gt;Me thinks this is going to be complicated ;)</description>
      <pubDate>Tue, 06 Aug 2002 17:19:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780754#M77129</guid>
      <dc:creator>Ron Bombard</dc:creator>
      <dc:date>2002-08-06T17:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780755#M77130</link>
      <description>Ron,&lt;BR /&gt;&lt;BR /&gt;Give us one line before and after the format.  Then we may help you better.&lt;BR /&gt;&lt;BR /&gt;Hai</description>
      <pubDate>Tue, 06 Aug 2002 17:23:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780755#M77130</guid>
      <dc:creator>Hai Nguyen_1</dc:creator>
      <dc:date>2002-08-06T17:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780756#M77131</link>
      <description>If I understand you correctly, you want to replace each single blank with one tab character.&lt;BR /&gt;&lt;BR /&gt;cat file | sed -e "s/ /\t/g"&lt;BR /&gt;&lt;BR /&gt;Note that \t should be replaced by the tab character.&lt;BR /&gt;&lt;BR /&gt;The "g" does the global replace.&lt;BR /&gt;&lt;BR /&gt;Tom</description>
      <pubDate>Tue, 06 Aug 2002 17:34:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780756#M77131</guid>
      <dc:creator>Tom Maloy</dc:creator>
      <dc:date>2002-08-06T17:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780757#M77132</link>
      <description>Ok, here's the before file.  I have 2 lines in it to show what happens when a field is missing.  The first line is a complete line.</description>
      <pubDate>Tue, 06 Aug 2002 17:42:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780757#M77132</guid>
      <dc:creator>Ron Bombard</dc:creator>
      <dc:date>2002-08-06T17:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780758#M77133</link>
      <description>Ok, here's the after unexpand file.  I have 2 lines in it to show what happens when a field is missing.  The first line is a complete line.</description>
      <pubDate>Tue, 06 Aug 2002 17:42:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780758#M77133</guid>
      <dc:creator>Ron Bombard</dc:creator>
      <dc:date>2002-08-06T17:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780759#M77134</link>
      <description>Problem with "unexpand" is...  there has to be more than 2 spaces together to convert to tab.  Some of my fields are only 2 space apart.   So, I ran the "unexpand-ed" file thru a "tr" filter and here's what I got&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Aug 2002 17:44:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780759#M77134</guid>
      <dc:creator>Ron Bombard</dc:creator>
      <dc:date>2002-08-06T17:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780760#M77135</link>
      <description>I think it might be easier for you with "cut", which is good at getting things at character positions...&lt;BR /&gt;&lt;BR /&gt;while read LINE&lt;BR /&gt;do&lt;BR /&gt;firstfield=`echo $LINE | cut -c 2-10`&lt;BR /&gt;secondfield=`echo $LINE | cur -c 11-20`&lt;BR /&gt;&lt;BR /&gt;printf( "%s\t%s\n", $firstfield, $secondfield)&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; inputfile&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Make a "firstfield" definition for each field in the record.&lt;BR /&gt;&lt;BR /&gt;Personally, I think this would probably be easier to write in C (certainly much faster to execute), but I'm guessing you don't know C.&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Aug 2002 18:17:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780760#M77135</guid>
      <dc:creator>Vincent Fleming</dc:creator>
      <dc:date>2002-08-06T18:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780761#M77136</link>
      <description>Hey thanks for the "cut" idea. I figured I have to do something like that.   Now... the "printf", I've never played with.&lt;BR /&gt;&lt;BR /&gt;Here's my script:&lt;BR /&gt;=======================&lt;BR /&gt;&lt;BR /&gt;while read LINE&lt;BR /&gt;do&lt;BR /&gt;time=`echo $LINE | cut -c 3-6`&lt;BR /&gt;duration=`echo $LINE | cut -c 8-11`&lt;BR /&gt;conncode=`echo $LINE | cut -c 12-13`&lt;BR /&gt;acccode=`echo $LINE | cut -c 15-17`&lt;BR /&gt;acccode2=`echo $LINE | cut -c 19-21`&lt;BR /&gt;dialed=`echo $INE | cut -c 23-37`&lt;BR /&gt;originate=`echo $LINE | cut -c 39-43`&lt;BR /&gt;&lt;BR /&gt;printf( "%s\t%s\n", $time, $duration, $conncode, $acccode, $acccode2, $dialed, $originate)&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; inputfile&lt;BR /&gt;=========================&lt;BR /&gt;&lt;BR /&gt;I ran piped the text file through this:&lt;BR /&gt;&lt;BR /&gt;cat txtfile | converterprg &lt;BR /&gt;&lt;BR /&gt;I get this error:&lt;BR /&gt;&lt;BR /&gt;./converter: line 11: syntax error near unexpected token `"%s\t%s\n",'&lt;BR /&gt;./converter: line 11: `printf( "%s\t%s\n", $time, $duration, $conncode, $acccode, $acccode2, $dialed, $originate)'&lt;BR /&gt;I'm not sure what this means...&lt;BR /&gt;Thanks!</description>
      <pubDate>Tue, 06 Aug 2002 18:40:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780761#M77136</guid>
      <dc:creator>Ron Bombard</dc:creator>
      <dc:date>2002-08-06T18:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780762#M77137</link>
      <description>Use sed or ed it doesn't matter. They both have tagged regular expressions and can slpit a line thus:-&lt;BR /&gt;&lt;BR /&gt;s/\(...\) *\(....\) *\(.....\)/\1\t\2\t\3\t/&lt;BR /&gt;&lt;BR /&gt;This will take three fields of 3,4 and 5 characters respectively, delimited by any number of spaces (including none) and format the same three fields but seperated by a 'tab' character. &lt;BR /&gt;&lt;BR /&gt;i.e. \(...\) takes the first 3 characters and \1 places these in the output.&lt;BR /&gt;&lt;BR /&gt;Change the ... to denote the characters that you require (for many characters use the notation .{m} where m is the number of characters. For whitespace use ['space'tab']* instead of space* or spacespace* which must match at least one space</description>
      <pubDate>Tue, 06 Aug 2002 18:48:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780762#M77137</guid>
      <dc:creator>Chris Lonergan</dc:creator>
      <dc:date>2002-08-06T18:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: sed, ed, (hurts my head)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780763#M77138</link>
      <description>Sorry - my syntax for the printf was incorrect.  It's been a while.  I gave the syntax for doing that in awk.&lt;BR /&gt;&lt;BR /&gt;Anyway, with these variables you defined:&lt;BR /&gt;&lt;BR /&gt;time=`echo $LINE | cut -c 3-6` &lt;BR /&gt;duration=`echo $LINE | cut -c 8-11` &lt;BR /&gt;conncode=`echo $LINE | cut -c 12-13` &lt;BR /&gt;acccode=`echo $LINE | cut -c 15-17` &lt;BR /&gt;acccode2=`echo $LINE | cut -c 19-21` &lt;BR /&gt;dialed=`echo $INE | cut -c 23-37` &lt;BR /&gt;originate=`echo $LINE | cut -c 39-43` &lt;BR /&gt;&lt;BR /&gt;You should use this syntax (in ksh):&lt;BR /&gt;&lt;BR /&gt;printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\n" "$time" "$duration" "$conncode" "$acccode" "$acccode2" "$dialed" "$originate"&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Aug 2002 12:03:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-ed-hurts-my-head/m-p/2780763#M77138</guid>
      <dc:creator>Vincent Fleming</dc:creator>
      <dc:date>2002-08-07T12:03:17Z</dc:date>
    </item>
  </channel>
</rss>

