<?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 need to do &amp;quot;od -x&amp;quot; on files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245028#M687399</link>
    <description>&lt;BR /&gt;I am trying to look for Control M characters in files on a particular directory and subdirectories underneath:&lt;BR /&gt;&lt;BR /&gt;find . -type f -print |xargs od -x |grep 0d&lt;BR /&gt;&lt;BR /&gt;All i get from this is a bunch of hexa numbers and not the actual filenames that have the od character.&lt;BR /&gt;&lt;BR /&gt;Another way I tried was this:&lt;BR /&gt;&lt;BR /&gt;for i in `find . -type f`; do  echo $i; od -x $i |grep 0d ; done&lt;BR /&gt;&lt;BR /&gt;but still get a very long list of ongoing hexa numbers...&lt;BR /&gt;&lt;BR /&gt;I just want to know which files have the control M ^M character and should not display hexa numbers.&lt;BR /&gt;&lt;BR /&gt;Any help would be greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Allan.&lt;BR /&gt;</description>
    <pubDate>Sat, 02 Aug 2008 17:01:25 GMT</pubDate>
    <dc:creator>Allanm</dc:creator>
    <dc:date>2008-08-02T17:01:25Z</dc:date>
    <item>
      <title>need to do "od -x" on files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245028#M687399</link>
      <description>&lt;BR /&gt;I am trying to look for Control M characters in files on a particular directory and subdirectories underneath:&lt;BR /&gt;&lt;BR /&gt;find . -type f -print |xargs od -x |grep 0d&lt;BR /&gt;&lt;BR /&gt;All i get from this is a bunch of hexa numbers and not the actual filenames that have the od character.&lt;BR /&gt;&lt;BR /&gt;Another way I tried was this:&lt;BR /&gt;&lt;BR /&gt;for i in `find . -type f`; do  echo $i; od -x $i |grep 0d ; done&lt;BR /&gt;&lt;BR /&gt;but still get a very long list of ongoing hexa numbers...&lt;BR /&gt;&lt;BR /&gt;I just want to know which files have the control M ^M character and should not display hexa numbers.&lt;BR /&gt;&lt;BR /&gt;Any help would be greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Allan.&lt;BR /&gt;</description>
      <pubDate>Sat, 02 Aug 2008 17:01:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245028#M687399</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2008-08-02T17:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: need to do "od -x" on files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245029#M687400</link>
      <description>In this case, the computer does exactly what you say, instead of what you mean.&lt;BR /&gt;&lt;BR /&gt;In your command lines, there is no way for the grep to know anything about the filenames, as there are no filenames in the output of the od command.&lt;BR /&gt;&lt;BR /&gt;The grep command has the option "-l" (list filenames only) which would be ideal to your problem. So it would be advantageous to skip the "od" and let grep do all the work. However, telling grep to recognize the ^M character is a bit tricky.&lt;BR /&gt;&lt;BR /&gt;Off the top of my head, I'd do it this way:&lt;BR /&gt;&lt;BR /&gt;find . -type f -exec grep -l $(echo '\r\c') {} \+&lt;BR /&gt;&lt;BR /&gt;NOTE the plus sign at the end: the "-exec [...] {} \+" construct is functionally the same as "-print | xargs [...]", but unlike xargs, it is immune to spaces and other difficult characters in the filenames.&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Sat, 02 Aug 2008 17:29:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245029#M687400</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2008-08-02T17:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: need to do "od -x" on files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245030#M687401</link>
      <description>&lt;BR /&gt;Thanks for replying so quickly MK,&lt;BR /&gt;&lt;BR /&gt;When I ran your command it gave me the following error:&lt;BR /&gt;&lt;BR /&gt;find . -type f -exec grep -l $(echo '\r\c') {} \+&lt;BR /&gt;&lt;BR /&gt;find: missing argument to `-exec'&lt;BR /&gt;&lt;BR /&gt;Also my xargs doesnt seem to work witg "grep -l" since the way I am using it :&lt;BR /&gt;&lt;BR /&gt;find . -type f |xargs od -x |grep -l 0d&lt;BR /&gt;(standard input)&lt;BR /&gt;xargs: od: terminated by signal 13&lt;BR /&gt;&lt;BR /&gt;Please suggest where I am going wrong.</description>
      <pubDate>Sat, 02 Aug 2008 17:53:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245030#M687401</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2008-08-02T17:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: need to do "od -x" on files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245031#M687402</link>
      <description>You are thinking too complex.&lt;BR /&gt;Just grep for ^M, which is a "carriage Return" and expressed as "\r"&lt;BR /&gt;(compare with "\n" for New-line)&lt;BR /&gt;&lt;BR /&gt;So I think you just want a simple: &lt;BR /&gt;&lt;BR /&gt;find . -type f | grep -e "\r" | od -c&lt;BR /&gt;&lt;BR /&gt;Note, this will not cause false positives on the text "\r" in the file name, this is just the represenation of 1 control character.&lt;BR /&gt;&lt;BR /&gt;Now you do not just want to print the filename, because that very ^M will cause the initial part to be overwritten.&lt;BR /&gt;&lt;BR /&gt;Try this as well:&lt;BR /&gt;&lt;BR /&gt;$  find . -type f | perl -ne 'print if s/\r/ &lt;CONTROL-M&gt; /'&lt;BR /&gt;&lt;BR /&gt;Finally... count yourself lucky you did not have to hunt for file names with new-lines!&lt;BR /&gt;You would then have to search non-line based for "\n" NOT followed by ./ nor EOF.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;/CONTROL-M&gt;</description>
      <pubDate>Sat, 02 Aug 2008 19:25:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245031#M687402</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-08-02T19:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: need to do "od -x" on files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245032#M687403</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You can always list non-printing characters in the filenames in octal '\ddd\' notation by doing:&lt;BR /&gt;&lt;BR /&gt;# ls -b&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 02 Aug 2008 20:36:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245032#M687403</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-08-02T20:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: need to do "od -x" on files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245033#M687404</link>
      <description>Thanks JRF! I alwasy forget about the -b option.&lt;BR /&gt;&lt;BR /&gt;The simple solution then becomes:&lt;BR /&gt;&lt;BR /&gt;$ ls -bR  | grep -h \015&lt;BR /&gt;test\015with carriage return&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;Using find is a little trickier.&lt;BR /&gt;I got an echo on the output which I can not immediatly explain/supress.&lt;BR /&gt;&lt;BR /&gt;$ find . -exec ls -b {} \; | grep -h \015&lt;BR /&gt;test\015with carriage return&lt;BR /&gt;./tmp/test\015with carriage return&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 02 Aug 2008 21:48:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245033#M687404</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-08-02T21:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: need to do "od -x" on filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245034#M687405</link>
      <description>&lt;!-- !*# --&gt;&lt;P&gt;&amp;gt;not the actual filenames that have the 0d character.&lt;BR /&gt;&lt;BR /&gt;It would have been helpful if you said filename and didn't imply file contents in your subject.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;All I get from this is a bunch of hex numbers and not the actual filenames that have the 0x0d character.&lt;BR /&gt;&lt;BR /&gt;Besides the correct solution Of JRF's with ls -b, you can use different tools:&lt;BR /&gt;1) Use GNU grep with context:&lt;BR /&gt;find . -type f | xd -tx1 -tc | grep -B1 0d&lt;BR /&gt;&lt;BR /&gt;2) Use sed to combine pairs of lines:&lt;BR /&gt;find . -type f | xd -tx1 -tc | sed -n -e 'N; /0b/p'&lt;BR /&gt;&lt;BR /&gt;3) Find the name directly:&lt;BR /&gt;find . -type f -name "*control-VcontrolM"&lt;BR /&gt;Note you may have to put this in a script. In my real shell I can't do this. You might be able to do this with MK's suggestion:&lt;BR /&gt;"$(echo '*\r*\c')"&lt;BR /&gt;&lt;BR /&gt;4) Use vis(1):&lt;BR /&gt;find . -type f | vis | grep '\r'&lt;BR /&gt;&lt;BR /&gt;&amp;gt;find . -type f | xargs od -x | grep 0d&lt;BR /&gt;&lt;BR /&gt;This looks at the file contents.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;for i in `find . -type f`; do echo $i; od -x $i |grep 0d ; done&lt;BR /&gt;&lt;BR /&gt;This looks at the name. To get the name vs hex you could do:&lt;BR /&gt;&lt;BR /&gt;find . -type f | while read name; do&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo $name | xd -x | grep -q 0d&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if [ $? -eq 0 ]; then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo $name&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&amp;gt;MK: find . -type f -exec grep -l $(echo '\r\c') {} \+&lt;BR /&gt;&lt;BR /&gt;You probably need to quote the echo to solve the missing argument:&lt;BR /&gt;"$(echo '\r\c')"&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Also my xargs doesn't seem to work ...&lt;BR /&gt;&lt;BR /&gt;We don't want you to use your xargs, since it looks inside the files.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Hein: Just grep for ^M, which is a "carriage Return" and expressed as "\r"&lt;BR /&gt;&lt;BR /&gt;A real shell doesn't understand \r, only echo and inv(1).&lt;BR /&gt;&lt;BR /&gt;&amp;gt;you do not just want to print the filename, because that very ^M will cause the initial part to be overwritten.&lt;BR /&gt;&lt;BR /&gt;Put it in a file and you can see both parts with vi.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;$ ls -bR | grep -h \015&lt;BR /&gt;&lt;BR /&gt;You need to quote that "\": ... | grep '\015'&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I got an echo on the output which I can not immediately explain/suppress.&lt;BR /&gt;&lt;BR /&gt;Where?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;$ find . -exec ls -b {} \; | grep -h \015&lt;BR /&gt;&lt;BR /&gt;Try:&lt;BR /&gt;$ find . -exec ls -b {} + | grep '\015'&lt;/P&gt;</description>
      <pubDate>Sun, 11 Sep 2011 13:01:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245034#M687405</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-09-11T13:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: need to do "od -x" on filenames</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245035#M687406</link>
      <description>&lt;P&gt;&amp;gt;You need to quote that "\": ... | grep '\015'&lt;BR /&gt;&lt;BR /&gt;Oops, you need to do: ... | grep '\\015'&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;I got an echo on the output which I can not immediately explain/suppress.&lt;BR /&gt;&lt;BR /&gt;Ah, you need to use ls -db&lt;BR /&gt;$ find . -exec ls -db {} + | grep '\\015'&lt;/P&gt;</description>
      <pubDate>Sun, 11 Sep 2011 13:02:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-to-do-quot-od-x-quot-on-files/m-p/4245035#M687406</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-09-11T13:02:29Z</dc:date>
    </item>
  </channel>
</rss>

