<?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: Use grep command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921875#M408047</link>
    <description>For extract or manipulate the data from the text file, it is better use awk command rather than grep.</description>
    <pubDate>Thu, 01 Sep 2005 04:43:07 GMT</pubDate>
    <dc:creator>midham</dc:creator>
    <dc:date>2005-09-01T04:43:07Z</dc:date>
    <item>
      <title>Use grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921869#M408041</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have a file where each line contain 200 chars but some line have less than 200 chars. I want to split it by 2 files where one file contain just 200 chars and another one less than 200 chars.&lt;BR /&gt;&lt;BR /&gt;Can i used grep command to solve this problem. &lt;BR /&gt;&lt;BR /&gt;Thanks in advance.</description>
      <pubDate>Tue, 30 Aug 2005 00:25:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921869#M408041</guid>
      <dc:creator>midham</dc:creator>
      <dc:date>2005-08-30T00:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921870#M408042</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm not sure that that grep is the best choice, I personally in this case prefer wc&lt;BR /&gt;&lt;BR /&gt;cat file | while read STRING; do&lt;BR /&gt;if [ $(echo $STRING|wc -c) -gt 200 ]; then&lt;BR /&gt; echo $STRING&amp;gt;&amp;gt;more200&lt;BR /&gt;else&lt;BR /&gt; echo $STRING &amp;gt;&amp;gt;less200&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Tue, 30 Aug 2005 03:01:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921870#M408042</guid>
      <dc:creator>Victor Fridyev</dc:creator>
      <dc:date>2005-08-30T03:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Use grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921871#M408043</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;awk might be helpful:&lt;BR /&gt;&lt;BR /&gt;# awk 'length == 200' ./infile&lt;BR /&gt;# awk 'length &amp;lt; 200' ./infile&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Tue, 30 Aug 2005 03:12:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921871#M408043</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-08-30T03:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Use grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921872#M408044</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I would prefer awk for this problem, but another useful tool is wc&lt;BR /&gt;&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;if [ $( echo $line |wc -c) -eq 200&lt;BR /&gt;then&lt;BR /&gt;echo $line &amp;gt;&amp;gt;file1&lt;BR /&gt;else&lt;BR /&gt;echo $line &amp;gt;&amp;gt;file2&lt;BR /&gt;done</description>
      <pubDate>Tue, 30 Aug 2005 03:32:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921872#M408044</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2005-08-30T03:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Use grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921873#M408045</link>
      <description>Here it is in a single line:&lt;BR /&gt;&lt;BR /&gt;awk ' { if ( length==200 ) print $0 &amp;gt; "200.txt"; else print $0 &amp;gt; "less200.txt";} ' textfile&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Alex</description>
      <pubDate>Tue, 30 Aug 2005 06:25:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921873#M408045</guid>
      <dc:creator>Alessandro Pilati</dc:creator>
      <dc:date>2005-08-30T06:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Use grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921874#M408046</link>
      <description>Thanks a lot. All of you are very excellent.</description>
      <pubDate>Thu, 01 Sep 2005 04:31:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921874#M408046</guid>
      <dc:creator>midham</dc:creator>
      <dc:date>2005-09-01T04:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Use grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921875#M408047</link>
      <description>For extract or manipulate the data from the text file, it is better use awk command rather than grep.</description>
      <pubDate>Thu, 01 Sep 2005 04:43:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/use-grep-command/m-p/4921875#M408047</guid>
      <dc:creator>midham</dc:creator>
      <dc:date>2005-09-01T04:43:07Z</dc:date>
    </item>
  </channel>
</rss>

