<?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 issues in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231528#M679873</link>
    <description>It worked just fine.&lt;BR /&gt;&lt;BR /&gt;Thanks for the explanation James!.&lt;BR /&gt;&lt;BR /&gt;Quoting did the trick.&lt;BR /&gt;&lt;BR /&gt;Regards!</description>
    <pubDate>Mon, 22 Mar 2010 20:46:14 GMT</pubDate>
    <dc:creator>Andres_13</dc:creator>
    <dc:date>2010-03-22T20:46:14Z</dc:date>
    <item>
      <title>grep issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231523#M679868</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm having issues with the following grep statement:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;File1="/tmp/Myfile"&lt;BR /&gt;String="100% packet loss"&lt;BR /&gt;Control="/tmp/Control_file.txt"&lt;BR /&gt;&lt;BR /&gt;/usr/bin/grep $String $File1 &amp;gt; $Control&lt;BR /&gt;Check=`/sbin/cat $Control | /usr/bin/wc -l`&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;With this I'm getting &lt;BR /&gt;grep: can't open packet&lt;BR /&gt;grep: can't open loss&lt;BR /&gt;&lt;BR /&gt;When I run it directly from command line:&lt;BR /&gt;&lt;BR /&gt;# String='100% packet loss'&lt;BR /&gt;# /usr/bin/grep $String $File1 &amp;gt; $Control  &lt;BR /&gt;grep: can't open packet&lt;BR /&gt;grep: can't open loss&lt;BR /&gt;&lt;BR /&gt;But if I do:&lt;BR /&gt;&lt;BR /&gt;# /usr/bin/grep '100% packet loss' $File1 &amp;gt; $Control&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;... It works! So what I'm doing wrong?&lt;BR /&gt;&lt;BR /&gt;Regards!</description>
      <pubDate>Mon, 22 Mar 2010 18:39:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231523#M679868</guid>
      <dc:creator>Andres_13</dc:creator>
      <dc:date>2010-03-22T18:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: grep issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231524#M679869</link>
      <description>there are spaces in your variable Strings.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;change to &lt;BR /&gt;String=\"100% packet loss\"&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Mar 2010 18:45:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231524#M679869</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2010-03-22T18:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: grep issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231525#M679870</link>
      <description>Thanks Tim,&lt;BR /&gt;&lt;BR /&gt;This what I'm get:&lt;BR /&gt;&lt;BR /&gt;# String=\"100% packet loss\"&lt;BR /&gt;sh: packet:  not found.&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Mar 2010 18:57:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231525#M679870</guid>
      <dc:creator>Andres_13</dc:creator>
      <dc:date>2010-03-22T18:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: grep issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231526#M679871</link>
      <description>Try this:&lt;BR /&gt;&lt;BR /&gt;/usr/bin/grep "${String}" $File1 &amp;gt; $Control</description>
      <pubDate>Mon, 22 Mar 2010 19:03:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231526#M679871</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2010-03-22T19:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: grep issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231527#M679872</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;As Patrick suggested, quote the '$String' variable.  This prevents the shell from evaluating it before 'grep' does.&lt;BR /&gt;&lt;BR /&gt;When you did:&lt;BR /&gt;&lt;BR /&gt;# String="100% packet loss"&lt;BR /&gt;&lt;BR /&gt;# /usr/bin/grep $String $File1 &amp;gt; $Control&lt;BR /&gt;&lt;BR /&gt;...The shell expanded things to:&lt;BR /&gt;&lt;BR /&gt;# /usr/bin/grep 100% packet loss /tmp/Myfile &amp;gt; /tmp/Control_file.txt&lt;BR /&gt;&lt;BR /&gt;...which isn't a syntax that 'grep' understands :-)&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 22 Mar 2010 19:49:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231527#M679872</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-03-22T19:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: grep issues</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231528#M679873</link>
      <description>It worked just fine.&lt;BR /&gt;&lt;BR /&gt;Thanks for the explanation James!.&lt;BR /&gt;&lt;BR /&gt;Quoting did the trick.&lt;BR /&gt;&lt;BR /&gt;Regards!</description>
      <pubDate>Mon, 22 Mar 2010 20:46:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-issues/m-p/5231528#M679873</guid>
      <dc:creator>Andres_13</dc:creator>
      <dc:date>2010-03-22T20:46:14Z</dc:date>
    </item>
  </channel>
</rss>

