<?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 awk - searching/replacing control characters in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855219#M94522</link>
    <description>People,&lt;BR /&gt;&lt;BR /&gt;I am trying to delete a load of control characters from a file that has acquired a load of new text via conversion problems. I.e.  the pipe delimitted file looks like :&lt;BR /&gt;&lt;BR /&gt;aaaa|bbbb|cccc^M&lt;BR /&gt;dddd|eeee|ffff^M&lt;BR /&gt;gggg|hhhh|iiii^M&lt;BR /&gt;&lt;BR /&gt;what I am trying to do is convert it to &lt;BR /&gt;&lt;BR /&gt;aaaa|bbbb|cccc|eor&lt;BR /&gt;dddd|eeee|ffff|eor&lt;BR /&gt;gggg|hhhh|iiii|eor&lt;BR /&gt;&lt;BR /&gt;I have tried the following :&lt;BR /&gt;&lt;BR /&gt;cat filename | awk -F"|" '&lt;BR /&gt;{printf("%s|%s|%s|eor",$1,$2,$3)}'&lt;BR /&gt;&lt;BR /&gt;but this gives :&lt;BR /&gt;&lt;BR /&gt;aaaa|bbbb|cccc^M|eor&lt;BR /&gt;dddd|eeee|ffff^M|eor&lt;BR /&gt;gggg|hhhh|iiii^M|eor&lt;BR /&gt;&lt;BR /&gt;With my limited knowledge of awk, could someone suggest a script that would do this, or better still, identify how awk (if it can that is), searches for this type of character (^M indicates a newline I think)&lt;BR /&gt;&lt;BR /&gt;thanks to you all!&lt;BR /&gt;John</description>
    <pubDate>Mon, 02 Dec 2002 10:52:24 GMT</pubDate>
    <dc:creator>Lemaitre</dc:creator>
    <dc:date>2002-12-02T10:52:24Z</dc:date>
    <item>
      <title>awk - searching/replacing control characters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855219#M94522</link>
      <description>People,&lt;BR /&gt;&lt;BR /&gt;I am trying to delete a load of control characters from a file that has acquired a load of new text via conversion problems. I.e.  the pipe delimitted file looks like :&lt;BR /&gt;&lt;BR /&gt;aaaa|bbbb|cccc^M&lt;BR /&gt;dddd|eeee|ffff^M&lt;BR /&gt;gggg|hhhh|iiii^M&lt;BR /&gt;&lt;BR /&gt;what I am trying to do is convert it to &lt;BR /&gt;&lt;BR /&gt;aaaa|bbbb|cccc|eor&lt;BR /&gt;dddd|eeee|ffff|eor&lt;BR /&gt;gggg|hhhh|iiii|eor&lt;BR /&gt;&lt;BR /&gt;I have tried the following :&lt;BR /&gt;&lt;BR /&gt;cat filename | awk -F"|" '&lt;BR /&gt;{printf("%s|%s|%s|eor",$1,$2,$3)}'&lt;BR /&gt;&lt;BR /&gt;but this gives :&lt;BR /&gt;&lt;BR /&gt;aaaa|bbbb|cccc^M|eor&lt;BR /&gt;dddd|eeee|ffff^M|eor&lt;BR /&gt;gggg|hhhh|iiii^M|eor&lt;BR /&gt;&lt;BR /&gt;With my limited knowledge of awk, could someone suggest a script that would do this, or better still, identify how awk (if it can that is), searches for this type of character (^M indicates a newline I think)&lt;BR /&gt;&lt;BR /&gt;thanks to you all!&lt;BR /&gt;John</description>
      <pubDate>Mon, 02 Dec 2002 10:52:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855219#M94522</guid>
      <dc:creator>Lemaitre</dc:creator>
      <dc:date>2002-12-02T10:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: awk - searching/replacing control characters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855220#M94523</link>
      <description>do this &lt;BR /&gt;cat test | awk -F"|" {printf("%s|%s|eor\n",$1,$2,$3)}'&lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
      <pubDate>Mon, 02 Dec 2002 10:59:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855220#M94523</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2002-12-02T10:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: awk - searching/replacing control characters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855221#M94524</link>
      <description>As an alternative, using sed you could try&lt;BR /&gt;&lt;BR /&gt;cat &lt;FILE&gt; | sed s/.$/\|eor/g&lt;BR /&gt;&lt;BR /&gt;This will replace any character followed by the end of line marker ($) with |eor&lt;/FILE&gt;</description>
      <pubDate>Mon, 02 Dec 2002 11:04:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855221#M94524</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2002-12-02T11:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: awk - searching/replacing control characters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855222#M94525</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;You should perhaps try to delete these ^m before reformatting using either sed ot dos2ux.&lt;BR /&gt;&lt;BR /&gt;dos2ux filename | awk '{printf "%s|eor\", $0)}&lt;BR /&gt;&lt;BR /&gt;or the most simple :&lt;BR /&gt;&lt;BR /&gt;sed 's/^\(.*\)^M/&amp;amp;|eor/' filename&lt;BR /&gt;&lt;BR /&gt;use ^V^M to avoid ^M interpretation.&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Mon, 02 Dec 2002 11:05:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855222#M94525</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2002-12-02T11:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: awk - searching/replacing control characters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855223#M94526</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I missed the \n in my previous response!&lt;BR /&gt;&lt;BR /&gt;I have been using :&lt;BR /&gt;&lt;BR /&gt;cat filename | awk -F"|" ' &lt;BR /&gt;{printf("%s|%s|%s|eor\n",$1,$2,$3)}' &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The awk script you mentioned, I think would miss out a column I need (cccc - eeee and iiii)&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;John&lt;BR /&gt;&lt;BR /&gt;P.s. I don't know why, but I have just logged in as myself, and got logged in as some person called Lemaitre!&lt;BR /&gt;&lt;BR /&gt;whats going on?????&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Dec 2002 11:07:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855223#M94526</guid>
      <dc:creator>u856100</dc:creator>
      <dc:date>2002-12-02T11:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: awk - searching/replacing control characters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855224#M94527</link>
      <description>Hi Chris,&lt;BR /&gt;&lt;BR /&gt;Clever '.$' :^) , not to deal with ^M interpretation. I like it !&lt;BR /&gt;&lt;BR /&gt;Jean-Louis.</description>
      <pubDate>Mon, 02 Dec 2002 11:07:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855224#M94527</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2002-12-02T11:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: awk - searching/replacing control characters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855225#M94528</link>
      <description>people!&lt;BR /&gt;&lt;BR /&gt;in addition to the fact that I have somehow logged in as another person (le-maitre).... I CANT assign points!!!&lt;BR /&gt;&lt;BR /&gt;NOOOO!</description>
      <pubDate>Mon, 02 Dec 2002 11:08:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855225#M94528</guid>
      <dc:creator>u856100</dc:creator>
      <dc:date>2002-12-02T11:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: awk - searching/replacing control characters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855226#M94529</link>
      <description># perl -pi -e's/[\r\n]+$/|eor\n/' filename</description>
      <pubDate>Mon, 02 Dec 2002 11:44:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855226#M94529</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-12-02T11:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: awk - searching/replacing control characters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855227#M94530</link>
      <description>did you ftp this file to your server?  if you did ftp it... did you use bin or ascii mode?  sometime i noted that using the wrong mode will add those characters to the end of each line.  Try ftp'ing the file again and see if you get the same results.  &lt;BR /&gt;&lt;BR /&gt;If you didn't ftp the file then just follow the suggestions above.</description>
      <pubDate>Mon, 02 Dec 2002 12:32:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855227#M94530</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2002-12-02T12:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: awk - searching/replacing control characters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855228#M94531</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;only an additional info:&lt;BR /&gt;this ^M is the UX-interpretation of a DOS carrige return.&lt;BR /&gt;To eliminate this character you only need a dos2ux!&lt;BR /&gt;dos2ux file&amp;gt;file2&lt;BR /&gt;and the ^M will disappear!&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Volkmar</description>
      <pubDate>Mon, 02 Dec 2002 14:08:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-searching-replacing-control-characters/m-p/2855228#M94531</guid>
      <dc:creator>V. Nyga</dc:creator>
      <dc:date>2002-12-02T14:08:59Z</dc:date>
    </item>
  </channel>
</rss>

