<?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: grep issue in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814127#M828002</link>
    <description>Here is a short perl program to scan for nuls and displays the record number it is found on.&lt;BR /&gt;Set $reclen to the length of your fixed length records.&lt;BR /&gt;&lt;BR /&gt;open(INP,"&lt;YOURFILE&gt;&lt;/YOURFILE&gt;$reclen=8;&lt;BR /&gt;while(read(INP,$datum,$reclen)) {&lt;BR /&gt; $nrec++;&lt;BR /&gt; if($datum=~/\00/m) { print "nul at record# $nrec\n";}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Hope this helps...&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
    <pubDate>Thu, 26 Sep 2002 14:20:25 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2002-09-26T14:20:25Z</dc:date>
    <item>
      <title>grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814119#M827994</link>
      <description>We have a 9Gb text file which has spurious nulls in it at various places. &lt;BR /&gt;The file is too big to vi on our system.&lt;BR /&gt;We would like to print out all the lines which contain nulls.  Unfortunately null (ASCII 0) is the string terminator, so awk, sed and grep take everything up the null as the string and everything afterwards as the next one.  &lt;BR /&gt;i.e. grep '\0' doesn't work, the manual says that null strings print every character anyway.&lt;BR /&gt;&lt;BR /&gt;Please test your ideas before posting them.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Sep 2002 13:37:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814119#M827994</guid>
      <dc:creator>Steve Lewis</dc:creator>
      <dc:date>2002-09-26T13:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814120#M827995</link>
      <description>Steve,&lt;BR /&gt;&lt;BR /&gt;are you trying to identify the lines that have embedded null's in them or trying to remove them??&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Thu, 26 Sep 2002 13:45:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814120#M827995</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-09-26T13:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814121#M827996</link>
      <description>How about "od filename | grep 0000"?&lt;BR /&gt;&lt;BR /&gt;See "man od"&lt;BR /&gt;&lt;BR /&gt;Marty</description>
      <pubDate>Thu, 26 Sep 2002 13:50:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814121#M827996</guid>
      <dc:creator>Martin Johnson</dc:creator>
      <dc:date>2002-09-26T13:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814122#M827997</link>
      <description>I need to identify which lines in the file have errors, so that the provider of the file can fix the erronious records and re-send them to me.&lt;BR /&gt;&lt;BR /&gt;These nulls form part of a fixed length record, so removing them or replacing them with something is not going to help.&lt;BR /&gt;&lt;BR /&gt;If only it were a simple case of replacement with tr '\0' ' ' &amp;lt; infile &amp;gt; outfile ...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Sep 2002 13:51:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814122#M827997</guid>
      <dc:creator>Steve Lewis</dc:creator>
      <dc:date>2002-09-26T13:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814123#M827998</link>
      <description>Martin obviously didn't test his idea, since it prints every line - the address is at the start of every column, starting 0000..</description>
      <pubDate>Thu, 26 Sep 2002 14:03:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814123#M827998</guid>
      <dc:creator>Steve Lewis</dc:creator>
      <dc:date>2002-09-26T14:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814124#M827999</link>
      <description>&lt;BR /&gt;Why not have them send you the file again without the nulls?&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Thu, 26 Sep 2002 14:04:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814124#M827999</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-09-26T14:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814125#M828000</link>
      <description>We will ask for it again without the nulls, but they are our new customer and I want to be nice and helpful.  Its a big file to search.&lt;BR /&gt;&lt;BR /&gt;Actually I have just spotted the C function call gets() reads to a new line, whereas fgets stops at nulls.  Maybe I could write a program, unless someone can come up with a neat bit of perl or python or something.</description>
      <pubDate>Thu, 26 Sep 2002 14:11:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814125#M828000</guid>
      <dc:creator>Steve Lewis</dc:creator>
      <dc:date>2002-09-26T14:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814126#M828001</link>
      <description>Steve,&lt;BR /&gt;&lt;BR /&gt;I did this:&lt;BR /&gt;&lt;BR /&gt;# echo 'a\0b' &amp;gt; /tmp/nulls&lt;BR /&gt;# echo hello &amp;gt;&amp;gt; /tmp/nulls&lt;BR /&gt;# od -c /tmp/nulls&lt;BR /&gt;0000000   a  \0   b  \n   h   e   l   l   o  \n&lt;BR /&gt;0000012&lt;BR /&gt;# echo '\0' &amp;gt; /tmp/null&lt;BR /&gt;# grep -f /tmp/null /tmp/nulls&lt;BR /&gt;ab&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin</description>
      <pubDate>Thu, 26 Sep 2002 14:14:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814126#M828001</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-09-26T14:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814127#M828002</link>
      <description>Here is a short perl program to scan for nuls and displays the record number it is found on.&lt;BR /&gt;Set $reclen to the length of your fixed length records.&lt;BR /&gt;&lt;BR /&gt;open(INP,"&lt;YOURFILE&gt;&lt;/YOURFILE&gt;$reclen=8;&lt;BR /&gt;while(read(INP,$datum,$reclen)) {&lt;BR /&gt; $nrec++;&lt;BR /&gt; if($datum=~/\00/m) { print "nul at record# $nrec\n";}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Hope this helps...&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Thu, 26 Sep 2002 14:20:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814127#M828002</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-09-26T14:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814128#M828003</link>
      <description>Thanks Robin and Rodney, well earned. &lt;BR /&gt;I learned something new today.&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Sep 2002 14:24:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814128#M828003</guid>
      <dc:creator>Steve Lewis</dc:creator>
      <dc:date>2002-09-26T14:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814129#M828004</link>
      <description>This will print the lines with NUL characters in them:&lt;BR /&gt;&lt;BR /&gt;perl -nle 'print if /\0/' &amp;lt; datafile&lt;BR /&gt;&lt;BR /&gt;Tom</description>
      <pubDate>Thu, 26 Sep 2002 14:50:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814129#M828004</guid>
      <dc:creator>Tom Maloy</dc:creator>
      <dc:date>2002-09-26T14:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: grep issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814130#M828005</link>
      <description>/No_Points_Please/&lt;BR /&gt;&lt;BR /&gt;Robin, that was a very elegant solution!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 27 Sep 2002 17:17:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issue/m-p/2814130#M828005</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-27T17:17:30Z</dc:date>
    </item>
  </channel>
</rss>

