<?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: how to remove content in a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062251#M306103</link>
    <description>Hi,&lt;BR /&gt;sed -n '/^Error/p' file&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
    <pubDate>Thu, 30 Aug 2007 02:33:56 GMT</pubDate>
    <dc:creator>Arturo Galbiati</dc:creator>
    <dc:date>2007-08-30T02:33:56Z</dc:date>
    <item>
      <title>how to remove content in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062242#M306094</link>
      <description>I hv a text file that has 500000 lines , some lines begins the word "Error" , if I want to delete all lines except the lines begins the word "Error" ( that means only keep "Error" lines ) , what can I do ? thx</description>
      <pubDate>Wed, 29 Aug 2007 05:55:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062242#M306094</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-08-29T05:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove content in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062243#M306095</link>
      <description>grep "Error" filename &amp;gt; newfile&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 29 Aug 2007 06:01:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062243#M306095</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2007-08-29T06:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove content in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062244#M306096</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;ex.&lt;BR /&gt;cat file1 | grep "^Error" &amp;gt;file2&lt;BR /&gt;&lt;BR /&gt;Marcin</description>
      <pubDate>Wed, 29 Aug 2007 06:02:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062244#M306096</guid>
      <dc:creator>Marcin O.</dc:creator>
      <dc:date>2007-08-29T06:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove content in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062245#M306097</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Using 'grep' is certainly one way to do this.  As shown by Marcin, you probably want to anchor your match to the beginning of the line since you said '...except lines [that begin with] the word "Error"'.&lt;BR /&gt;&lt;BR /&gt;It is wasteful to 'cat' the file into a pipe to 'grep'.  That adds another process!&lt;BR /&gt;&lt;BR /&gt;You could also use Perl and to select lines beginning with "Error" and having a word-boundry on either side (\b).&lt;BR /&gt;&lt;BR /&gt;# perl -ne 'print if /\bError\b/' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 29 Aug 2007 06:28:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062245#M306097</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-29T06:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove content in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062246#M306098</link>
      <description>Hi&lt;BR /&gt;Of course all above methods are correct, but I check speed of processing those three methods. If you interested in&lt;BR /&gt;&lt;BR /&gt;1. only grep&lt;BR /&gt;2. cat+grep&lt;BR /&gt;3. perl&lt;BR /&gt;on file with 4M lines, result was:&lt;BR /&gt;1. 4.1s&lt;BR /&gt;2. 4.5s&lt;BR /&gt;3. 9.5s&lt;BR /&gt;&lt;BR /&gt;Marcin</description>
      <pubDate>Wed, 29 Aug 2007 07:12:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062246#M306098</guid>
      <dc:creator>Marcin O.</dc:creator>
      <dc:date>2007-08-29T07:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove content in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062247#M306099</link>
      <description>ust3,&lt;BR /&gt;&lt;BR /&gt;Please be VERY explicit about 'Error'.&lt;BR /&gt;Spelled EXACTLY so, or more upper/lower combinations&lt;BR /&gt;Exactly in the beginning of the line, or 'close' (how close!).&lt;BR /&gt;Or are you looking for 'Error' anywhere as seperate word(the first perl solution)?&lt;BR /&gt;&lt;BR /&gt;Marcin,&lt;BR /&gt;&lt;BR /&gt;Whiel you are trying... please re-try perl again with an anchorred RE where it does not have to scan the whole line:&lt;BR /&gt;&lt;BR /&gt;# perl -ne 'print if /^Error/' file&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Aug 2007 07:49:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062247#M306099</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-08-29T07:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove content in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062248#M306100</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Ooops, thanks Hein, I beat the anchor drum and then mistyped myself :-{&lt;BR /&gt;&lt;BR /&gt;Also, while I would expect Perl to have a small startup overhead, its value in cases like this lies in its superior regular expression engine.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 29 Aug 2007 07:54:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062248#M306100</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-29T07:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove content in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062249#M306101</link>
      <description># awk '$0~/^Error/' file</description>
      <pubDate>Wed, 29 Aug 2007 08:32:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062249#M306101</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-08-29T08:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove content in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062250#M306102</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;even shorter as Sandman's solution:&lt;BR /&gt;awk '/^Error/' file&lt;BR /&gt;&lt;BR /&gt;or taking '"Error" is the first word' into account:&lt;BR /&gt;awk '$1=="Error"' file&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Wed, 29 Aug 2007 09:51:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062250#M306102</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-08-29T09:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove content in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062251#M306103</link>
      <description>Hi,&lt;BR /&gt;sed -n '/^Error/p' file&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Thu, 30 Aug 2007 02:33:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-remove-content-in-a-file/m-p/4062251#M306103</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2007-08-30T02:33:56Z</dc:date>
    </item>
  </channel>
</rss>

