<?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: control M characters in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010544#M96338</link>
    <description>&amp;gt;fgrep -q ^M file&lt;BR /&gt;dint work.&lt;BR /&gt;&lt;BR /&gt;Works fine for me using a real shell.  As I said, you have to create a script with control M.  You can't enter it directly to the shell.</description>
    <pubDate>Thu, 31 May 2007 07:02:50 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2007-05-31T07:02:50Z</dc:date>
    <item>
      <title>control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010540#M96334</link>
      <description>Hi,&lt;BR /&gt;I wanna check if a file contains control M [^M]&lt;BR /&gt;characters in it.&lt;BR /&gt;Not a perl script, but a shell script solution.&lt;BR /&gt;Can I check for it</description>
      <pubDate>Thu, 31 May 2007 05:55:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010540#M96334</guid>
      <dc:creator>Rinky</dc:creator>
      <dc:date>2007-05-31T05:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010541#M96335</link>
      <description>If you want to just convert them, you can use dos2ux(1).&lt;BR /&gt;&lt;BR /&gt;Otherwise you can use grep but you'll have problems getting a control M into the shell.&lt;BR /&gt;&lt;BR /&gt;I was able to use control V, then control M in vi to get:&lt;BR /&gt;$ fgrep -q ^M file&lt;BR /&gt;</description>
      <pubDate>Thu, 31 May 2007 06:09:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010541#M96335</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-31T06:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010542#M96336</link>
      <description>hi&lt;BR /&gt;&lt;BR /&gt;try:&lt;BR /&gt;find . -type f |xargs grep -l ^M &lt;BR /&gt;&lt;BR /&gt;Where the ^M character should be typed as:&lt;BR /&gt;ctrl+v ctrl+m&lt;BR /&gt;&lt;BR /&gt;hope this helps!&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Thu, 31 May 2007 06:35:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010542#M96336</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2007-05-31T06:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010543#M96337</link>
      <description>fgrep -q ^M file&lt;BR /&gt;dint work..&lt;BR /&gt;I have attached the file.&lt;BR /&gt;You can test this file</description>
      <pubDate>Thu, 31 May 2007 06:53:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010543#M96337</guid>
      <dc:creator>Rinky</dc:creator>
      <dc:date>2007-05-31T06:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010544#M96338</link>
      <description>&amp;gt;fgrep -q ^M file&lt;BR /&gt;dint work.&lt;BR /&gt;&lt;BR /&gt;Works fine for me using a real shell.  As I said, you have to create a script with control M.  You can't enter it directly to the shell.</description>
      <pubDate>Thu, 31 May 2007 07:02:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010544#M96338</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-31T07:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010545#M96339</link>
      <description>Here is my script.</description>
      <pubDate>Thu, 31 May 2007 07:04:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010545#M96339</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-31T07:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010546#M96340</link>
      <description>Hi Rinky:&lt;BR /&gt;&lt;BR /&gt;What's (?) so hard with:&lt;BR /&gt;&lt;BR /&gt;# perl -ne 'print if /\015/' file&lt;BR /&gt;&lt;BR /&gt;THe \015 is the octal code for a Carriage-Return which is graphically seens as ^M.  The Perl snippet reads every line of a 'file' passed printing any line that has a carriage-return in it.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 31 May 2007 08:00:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010546#M96340</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-31T08:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010547#M96341</link>
      <description>...or you can stick the ^M in a "pattern file" and use it.  for example, file "P1" contains the Ctrl-M, then you can do:&lt;BR /&gt;&lt;BR /&gt;grep -f P1 &lt;YOURFILE&gt;&lt;BR /&gt;&lt;BR /&gt;or for all Control characters, try&lt;BR /&gt;&lt;BR /&gt;grep [:ctrl:] &lt;YOURFILE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/YOURFILE&gt;&lt;/YOURFILE&gt;</description>
      <pubDate>Thu, 31 May 2007 09:18:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010547#M96341</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2007-05-31T09:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010548#M96342</link>
      <description>Simplest would be to grep for the Ctrl-M character which is inserted into the cmd line by holding down the "Ctrl", "V" and "M" keys simultaneously on your keyboard i.e.&lt;BR /&gt;&lt;BR /&gt;# grep -q ^M infile &amp;amp;&amp;amp; echo "Ctrl M chars found" || echo "No Ctrl M chars found"</description>
      <pubDate>Thu, 31 May 2007 09:33:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010548#M96342</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-05-31T09:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010549#M96343</link>
      <description>FYI:&lt;BR /&gt;&lt;BR /&gt;Sandman, your solution occurred to me also, but when i tried it in ksh on 11.0, entering that key sequence generated a Ctrl-J on the command line.  Suspect its an issue w/ "set -o vi" / .exrc / .kshrc, but didn't check further...just proceeded on in a different direction</description>
      <pubDate>Thu, 31 May 2007 09:50:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010549#M96343</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2007-05-31T09:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010550#M96344</link>
      <description>You're right OldSchool I am unable to duplicate the command line I created under the sh-posix(1) shell. Hmmm...needs to be looked into.</description>
      <pubDate>Thu, 31 May 2007 10:46:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010550#M96344</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-05-31T10:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010551#M96345</link>
      <description>Here's a sneaky way to do it leveraging echo.&lt;BR /&gt;&lt;BR /&gt;If testing a shell variable then:&lt;BR /&gt;&lt;BR /&gt;echo "${MYVAR}" | grep -q $(echo "\r\c")&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "CR Found"&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;If testing a file:&lt;BR /&gt;&lt;BR /&gt;grep -q $(echo "\r\c") infile&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "CR Found"&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 31 May 2007 10:59:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010551#M96345</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-31T10:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010552#M96346</link>
      <description>&amp;gt;Sandman: I am unable to duplicate the command line I created&lt;BR /&gt;&lt;BR /&gt;I kept saying that.  But vi allows ^M.</description>
      <pubDate>Thu, 31 May 2007 14:36:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010552#M96346</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-31T14:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010553#M96347</link>
      <description>Hi,&lt;BR /&gt;grep [\015] file &lt;BR /&gt;&lt;BR /&gt;it's ok on my Hp-UX 11i&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Fri, 01 Jun 2007 03:18:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010553#M96347</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2007-06-01T03:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010554#M96348</link>
      <description>&amp;gt;Art: grep [\015] file&lt;BR /&gt;&lt;BR /&gt;I almost took you at your word since I didn't check this.  (I forgot what Ronnie said. ;-)&lt;BR /&gt;But now I did and this does not work in a real shell.  What shell did you use?&lt;BR /&gt;&lt;BR /&gt;A similar (but quoted) syntax works in tr(1): "[\015]"</description>
      <pubDate>Sat, 02 Jun 2007 02:39:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010554#M96348</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-02T02:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010555#M96349</link>
      <description>try to run&lt;BR /&gt;#dos2ux test1 &amp;gt; test2&lt;BR /&gt;&lt;BR /&gt;your ^M will be remove at file test2.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;freddy</description>
      <pubDate>Sun, 03 Jun 2007 20:52:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010555#M96349</guid>
      <dc:creator>freddy_21</dc:creator>
      <dc:date>2007-06-03T20:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010556#M96350</link>
      <description>grep -q $(echo "\r\c") infile&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt;echo "CR Found"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;worked fine.. &lt;BR /&gt;thanks..</description>
      <pubDate>Tue, 05 Jun 2007 03:32:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010556#M96350</guid>
      <dc:creator>Rinky</dc:creator>
      <dc:date>2007-06-05T03:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010557#M96351</link>
      <description>WOW!!&lt;BR /&gt;dos2ux test1 &amp;gt; test2&lt;BR /&gt;perfect command..&lt;BR /&gt;Thanks a lotttttt...</description>
      <pubDate>Tue, 05 Jun 2007 03:33:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010557#M96351</guid>
      <dc:creator>Rinky</dc:creator>
      <dc:date>2007-06-05T03:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010558#M96352</link>
      <description>Well duh! &lt;BR /&gt;Just like you were informed in the very first reply a week ago!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Jun 2007 06:28:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010558#M96352</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-06-05T06:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: control M characters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010559#M96353</link>
      <description>&amp;gt;Hein: Just like you were informed in the very first reply a week ago!&lt;BR /&gt;&lt;BR /&gt;Exactly.&lt;BR /&gt;&lt;BR /&gt;Other than Clay's echo trick, OldSchool's file of CR and JRF's perl script, nothing was added since my first reply.&lt;BR /&gt;(And I only got 4 points.  Though Rinky can add some more.  ;-)</description>
      <pubDate>Tue, 05 Jun 2007 06:37:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-m-characters/m-p/4010559#M96353</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-05T06:37:58Z</dc:date>
    </item>
  </channel>
</rss>

