<?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: script to remove line in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221981#M327552</link>
    <description>sed -e '/testing error/d' &amp;lt; event_log &amp;gt; new_event_log&lt;BR /&gt;&lt;BR /&gt;HTH..&lt;BR /&gt;</description>
    <pubDate>Wed, 25 Jun 2008 07:55:04 GMT</pubDate>
    <dc:creator>Saravanan_6</dc:creator>
    <dc:date>2008-06-25T07:55:04Z</dc:date>
    <item>
      <title>script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221979#M327550</link>
      <description>I have a log file ( event_log ) , there are many process write the word "testing error" to it , if I want to have a script to regularly ( the interval should be as short as possible , may be 1 or 2 second ) delete the line that have the word "testing error" ( the best is delete the line when it was created ) , can advise what can i do , can provide the script? thx&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#vi event_log &lt;BR /&gt;&lt;BR /&gt;aa&lt;BR /&gt;testing error&lt;BR /&gt;bb&lt;BR /&gt;cc&lt;BR /&gt;testing error &lt;BR /&gt;dd &lt;BR /&gt;testing error&lt;BR /&gt;ee&lt;BR /&gt;ff&lt;BR /&gt;gg&lt;BR /&gt;&lt;BR /&gt;after update , it should be changed to &lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;cc&lt;BR /&gt;dd&lt;BR /&gt;ee&lt;BR /&gt;ff&lt;BR /&gt;gg</description>
      <pubDate>Wed, 25 Jun 2008 07:42:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221979#M327550</guid>
      <dc:creator>haeman</dc:creator>
      <dc:date>2008-06-25T07:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221980#M327551</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;sed '/^testing error/ d' event_log&lt;BR /&gt;&lt;BR /&gt;you can redirect the output to another file.&lt;BR /&gt;&lt;BR /&gt;Kenan.</description>
      <pubDate>Wed, 25 Jun 2008 07:51:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221980#M327551</guid>
      <dc:creator>Kenan Erdey</dc:creator>
      <dc:date>2008-06-25T07:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221981#M327552</link>
      <description>sed -e '/testing error/d' &amp;lt; event_log &amp;gt; new_event_log&lt;BR /&gt;&lt;BR /&gt;HTH..&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jun 2008 07:55:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221981#M327552</guid>
      <dc:creator>Saravanan_6</dc:creator>
      <dc:date>2008-06-25T07:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221982#M327553</link>
      <description>&lt;!--!*#--&gt;Hi &lt;BR /&gt;   You can create a script containing following lines and put that in cron. &lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;cat event_log |grep -v testing &amp;gt;event_log.new&lt;BR /&gt;&lt;BR /&gt; Thanks&lt;BR /&gt; Davis Paul&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jun 2008 07:57:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221982#M327553</guid>
      <dc:creator>Davis Paul</dc:creator>
      <dc:date>2008-06-25T07:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221983#M327554</link>
      <description>thx replies, &lt;BR /&gt;&lt;BR /&gt;the command is work, but if I want the script run frenquently ( eg. every 1 sec ) , what can i do ? thx</description>
      <pubDate>Wed, 25 Jun 2008 07:59:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221983#M327554</guid>
      <dc:creator>haeman</dc:creator>
      <dc:date>2008-06-25T07:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221984#M327555</link>
      <description>it isnt' nice to mention but:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I have assigned points to   1  of   116  responses to  my questions.&lt;BR /&gt;&lt;BR /&gt;A.Clay and SEP get very angry for these cases :)</description>
      <pubDate>Wed, 25 Jun 2008 08:00:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221984#M327555</guid>
      <dc:creator>Kenan Erdey</dc:creator>
      <dc:date>2008-06-25T08:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221985#M327556</link>
      <description>if you install gnu sed from this location:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.cs.utah.edu/hppd/hpux/Gnu/sed-4.1.5/" target="_blank"&gt;http://hpux.cs.utah.edu/hppd/hpux/Gnu/sed-4.1.5/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;you can use -i option to edit in place. So no need to redirect.&lt;BR /&gt;&lt;BR /&gt;Kenan.</description>
      <pubDate>Wed, 25 Jun 2008 08:08:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221985#M327556</guid>
      <dc:creator>Kenan Erdey</dc:creator>
      <dc:date>2008-06-25T08:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221986#M327557</link>
      <description>thx reply,&lt;BR /&gt;&lt;BR /&gt;the script sed '/^testing error/ d' event_log will output the result to screen , if I want to directly update the event_log , what can i do ? thx</description>
      <pubDate>Wed, 25 Jun 2008 08:09:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221986#M327557</guid>
      <dc:creator>haeman</dc:creator>
      <dc:date>2008-06-25T08:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221987#M327558</link>
      <description>&lt;!--!*#--&gt;Hi &lt;BR /&gt; Create a script like following and execute.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while ((1 &amp;gt; 0))&lt;BR /&gt;do&lt;BR /&gt;$cat event_log |grep -v testing &amp;gt;event_log.new&lt;BR /&gt;mv event_log.new event_log&lt;BR /&gt;sleep 5&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jun 2008 08:30:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221987#M327558</guid>
      <dc:creator>Davis Paul</dc:creator>
      <dc:date>2008-06-25T08:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221988#M327559</link>
      <description>thx reply &lt;BR /&gt;&lt;BR /&gt;Davis Paul's script can do that , but I think some data will be lost when the file is in movement , the sed method seems good , can advise how to use it to direct update the file ? thx</description>
      <pubDate>Wed, 25 Jun 2008 09:35:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221988#M327559</guid>
      <dc:creator>haeman</dc:creator>
      <dc:date>2008-06-25T09:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221989#M327560</link>
      <description>i wrote before. you can use gnu sed.</description>
      <pubDate>Wed, 25 Jun 2008 09:40:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221989#M327560</guid>
      <dc:creator>Kenan Erdey</dc:creator>
      <dc:date>2008-06-25T09:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221990#M327561</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;Nah. All wrong.&lt;BR /&gt;&lt;BR /&gt;What you want to do to solve this kind of problem is to use a PIPE aka FIFO&lt;BR /&gt;&lt;BR /&gt;Instead od the providers writing (appending) to a real file, have them use a fifo. Now have a slave reading the fifo all the time and filter the data before going to the output.&lt;BR /&gt;&lt;BR /&gt;For example.&lt;BR /&gt;&lt;BR /&gt;A perl script: event_log_filter.pl&lt;BR /&gt;-------------&lt;BR /&gt;use IO::Handle;&lt;BR /&gt;open (OUT, "&amp;gt;&amp;gt;event_log_real") or die "no OUT";&lt;BR /&gt;OUT-&amp;gt;autoflush(1);&lt;BR /&gt;while (1){&lt;BR /&gt;  open (IN, "&lt;EVENT_LOG&gt;&lt;/EVENT_LOG&gt;  while (&lt;IN&gt;) {&lt;BR /&gt;    print OUT unless /^testing error/;&lt;BR /&gt;  }&lt;BR /&gt;  print "are we done yet?\n";&lt;BR /&gt;}&lt;BR /&gt;------------&lt;BR /&gt;&lt;BR /&gt;Now try in one window&lt;BR /&gt;&lt;BR /&gt;# mkfifo event_log&lt;BR /&gt;# perl event_log_filter.p &amp;amp;&lt;BR /&gt;# tail -f event_log_real&lt;BR /&gt;&lt;BR /&gt;And in an other window (or windows)&lt;BR /&gt;&lt;BR /&gt;# cat &amp;gt; event_log&lt;BR /&gt;blah&lt;BR /&gt;blah blah&lt;BR /&gt;testing error&lt;BR /&gt;blah&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/IN&gt;</description>
      <pubDate>Wed, 25 Jun 2008 09:50:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221990#M327561</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-06-25T09:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221991#M327562</link>
      <description>&amp;gt;the interval should be as short as possible, may be 1 or 2 second)&lt;BR /&gt;&lt;BR /&gt;I near panicked when I read this time requirement.  You can't edit a file where other processes are trying to write to it.  (Unless you are using fancy locking, etc.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;can advise how to use it to direct update the file?&lt;BR /&gt;&lt;BR /&gt;This will still lose data.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Hein: All wrong.&lt;BR /&gt;&amp;gt;What you want to do to solve this kind of problem is to use a PIPE aka FIFO&lt;BR /&gt;&lt;BR /&gt;Exactly.  Or filter the stuff out just before you use it.  (This wouldn't be helpful if the junk bloats the file too much.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Kenan: A.Clay and SEP get very angry for these cases :)&lt;BR /&gt;&lt;BR /&gt;(It's called struck off.  :-)  (haeman's now up to 64!)</description>
      <pubDate>Wed, 25 Jun 2008 16:41:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221991#M327562</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-06-25T16:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221992#M327563</link>
      <description>thx reply,&lt;BR /&gt;&lt;BR /&gt;I think Hein van den Heuvel 's method is OK , but it is required to install module to the server , it is too complicate for me ,&lt;BR /&gt;&lt;BR /&gt;I still think the command "sed '/^testing error/ d' event_log" is simple and meet my requirment , but I would like to ask how to direct update the file instead output to another file ?&lt;BR /&gt;&lt;BR /&gt;please ignore the data lost issue .&lt;BR /&gt;&lt;BR /&gt;thx</description>
      <pubDate>Thu, 26 Jun 2008 10:26:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221992#M327563</guid>
      <dc:creator>haeman</dc:creator>
      <dc:date>2008-06-26T10:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221993#M327564</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I think Hein van den Heuvel's method is OK, but it is required to install module to the server, it is too complicate for me&lt;BR /&gt;&lt;BR /&gt;That's not true.  the 'IO::Handle' modules was released with Perl 5.00307.  If, however, you would like to skip using it, for whatever reason, you can make the following change:&lt;BR /&gt;&lt;BR /&gt;Instead of the line:&lt;BR /&gt;&lt;BR /&gt;# OUT-&amp;gt;autoflush(1);&lt;BR /&gt;&lt;BR /&gt;...use these two statements:&lt;BR /&gt;&lt;BR /&gt;# select OUT;&lt;BR /&gt;# $|++;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 26 Jun 2008 10:57:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-line/m-p/4221993#M327564</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-06-26T10:57:01Z</dc:date>
    </item>
  </channel>
</rss>

