<?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: ignoring null values while greping in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ignoring-null-values-while-greping/m-p/5098455#M443685</link>
    <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Appologies for late reply.&lt;BR /&gt;Thanks a lot i got answer of my query.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
    <pubDate>Wed, 19 Mar 2008 08:09:55 GMT</pubDate>
    <dc:creator>N Gopal</dc:creator>
    <dc:date>2008-03-19T08:09:55Z</dc:date>
    <item>
      <title>ignoring null values while greping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ignoring-null-values-while-greping/m-p/5098452#M443682</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have one file say:&lt;BR /&gt;&lt;BR /&gt;myfile.txt, entries are:&lt;BR /&gt;&lt;BR /&gt;"1234","0001"&lt;BR /&gt;"1235"," "&lt;BR /&gt;"1236"," "&lt;BR /&gt;"1237","0002"&lt;BR /&gt;&lt;BR /&gt;I have writen code:&lt;BR /&gt;&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;   deep_cd= "NULL"&lt;BR /&gt; deep_cd=`grep "$deep_code" myfile.txt | cut -f2 -d','` &lt;BR /&gt;if [ deep_cd = null value ] then&lt;BR /&gt;deep_cd=NULL&lt;BR /&gt;else&lt;BR /&gt;echo " Value of deep_cd is $deep_cd "&lt;BR /&gt;&lt;BR /&gt;               &lt;BR /&gt;fi;  &lt;BR /&gt;    echo "$deep_cd" &amp;gt;&amp;gt; diw_output&lt;BR /&gt;  done&lt;MYFILE.TXT&gt;&lt;/MYFILE.TXT&gt;&lt;BR /&gt;Output file will be something like:&lt;BR /&gt;&lt;BR /&gt;my_output:&lt;BR /&gt;&lt;BR /&gt;"0001"&lt;BR /&gt;NULL&lt;BR /&gt;"0002"&lt;BR /&gt;&lt;BR /&gt;Can some one please help me in this regard.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;        &lt;BR /&gt;                                    &lt;BR /&gt;     &lt;BR /&gt;              &lt;BR /&gt;</description>
      <pubDate>Tue, 18 Mar 2008 10:49:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ignoring-null-values-while-greping/m-p/5098452#M443682</guid>
      <dc:creator>N Gopal</dc:creator>
      <dc:date>2008-03-18T10:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: ignoring null values while greping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ignoring-null-values-while-greping/m-p/5098453#M443683</link>
      <description>You can test for "definedness" (rather zero length string values) in the shell by&lt;BR /&gt;e.g.&lt;BR /&gt;[[ -z $deep_cd ]] &amp;amp;&amp;amp; deep_cd=NULL&lt;BR /&gt;&lt;BR /&gt;Does this help?</description>
      <pubDate>Tue, 18 Mar 2008 12:22:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ignoring-null-values-while-greping/m-p/5098453#M443683</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-03-18T12:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: ignoring null values while greping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ignoring-null-values-while-greping/m-p/5098454#M443684</link>
      <description>&lt;!--!*#--&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;This would yield your desired output using the input you showed:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;IFS=","&lt;BR /&gt;while read A B&lt;BR /&gt;do&lt;BR /&gt;  if [ "${B}" = '""' -o "${B}" = '" "' -o -z "${B}" ]; then&lt;BR /&gt;    echo "NULL"&lt;BR /&gt;  else&lt;BR /&gt;    echo ${B}&lt;BR /&gt;  fi&lt;BR /&gt;done &amp;lt; ./myfile.txt&lt;BR /&gt;&lt;BR /&gt;...please cut-and-paste since the Forum will make this difficult to read...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Mar 2008 12:42:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ignoring-null-values-while-greping/m-p/5098454#M443684</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-03-18T12:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: ignoring null values while greping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ignoring-null-values-while-greping/m-p/5098455#M443685</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Appologies for late reply.&lt;BR /&gt;Thanks a lot i got answer of my query.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 19 Mar 2008 08:09:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ignoring-null-values-while-greping/m-p/5098455#M443685</guid>
      <dc:creator>N Gopal</dc:creator>
      <dc:date>2008-03-19T08:09:55Z</dc:date>
    </item>
  </channel>
</rss>

