<?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: help in removing entries from a file in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066721#M94611</link>
    <description>&amp;gt;JRF: extended regular expressions&lt;BR /&gt;&lt;BR /&gt;No need to use the -E hammer, your regular expressions (*) aren't extended.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Peter: Best use 1[.]2[.]3[.]4&lt;BR /&gt;&lt;BR /&gt;Usually they are quoted with a "\".&lt;BR /&gt;&lt;BR /&gt;&amp;gt;if your pattern are anchored at begin or end of a line. Taking this into account can speed up your script dramatically!&lt;BR /&gt;&lt;BR /&gt;Right.  You can do that with grep -x but the logfile could only have that number and no other data on each line.&lt;BR /&gt;&lt;BR /&gt;I'm surprised Peter didn't mention the gotcha with fgrep, 1.2.3.4 will match 21.2.3.4&lt;BR /&gt;&lt;BR /&gt;So you need to use grep -w, or use anchored strings in the file.  Given't JRF's file:&lt;BR /&gt;10\.11\.[0-9]*\.2 &lt;BR /&gt;&lt;BR /&gt;You could use vi to add the anchors:&lt;BR /&gt;:%s/^/^/&lt;BR /&gt;:%s/$/$/</description>
    <pubDate>Mon, 03 Sep 2007 16:47:19 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2007-09-03T16:47:19Z</dc:date>
    <item>
      <title>help in removing entries from a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066712#M94602</link>
      <description>Guys,&lt;BR /&gt;&lt;BR /&gt;I could do with some help:&lt;BR /&gt;&lt;BR /&gt;I have a file with a list of entries that I want to remove from a logfile:&lt;BR /&gt;&lt;BR /&gt;iprange1&lt;BR /&gt;iprange2&lt;BR /&gt;iprange3&lt;BR /&gt;iprange4&lt;BR /&gt;&lt;BR /&gt;what would be the best way to remove these from a logfile with many ipranges in?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 03 Sep 2007 05:06:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066712#M94602</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-09-03T05:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: help in removing entries from a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066713#M94603</link>
      <description>Hey&lt;BR /&gt;&lt;BR /&gt;something like that:&lt;BR /&gt;&lt;BR /&gt;$cat logfile | grep -v ipranges &amp;gt; temp.file&lt;BR /&gt;$cat temp.file &amp;gt; logfile&lt;BR /&gt;&lt;BR /&gt;or what syntax have your iprange?&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Sep 2007 05:12:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066713#M94603</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-09-03T05:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: help in removing entries from a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066714#M94604</link>
      <description>Hi Lawrenzo,&lt;BR /&gt;&lt;BR /&gt;See also&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1156808" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1156808&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;WK</description>
      <pubDate>Mon, 03 Sep 2007 05:17:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066714#M94604</guid>
      <dc:creator>whiteknight</dc:creator>
      <dc:date>2007-09-03T05:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: help in removing entries from a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066715#M94605</link>
      <description>ok yes I know these options however what I am looking for is instead of doing:&lt;BR /&gt;&lt;BR /&gt;grep -v iprange1 |grep -v iprange2 |grep -v iprange3 etc etc&lt;BR /&gt;&lt;BR /&gt;is have a list of each different iprange that I do not what to display from the logfile in a file then use this to not display from the log:&lt;BR /&gt;&lt;BR /&gt;ie&lt;BR /&gt;&lt;BR /&gt;how do I have a file with &lt;BR /&gt;&lt;BR /&gt;iprange1&lt;BR /&gt;iprange2&lt;BR /&gt;iprange3&lt;BR /&gt;iprange4&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;then not display this information from the logfile that has multiple entries of &lt;BR /&gt;&lt;BR /&gt;iprange1&lt;BR /&gt;iprange2&lt;BR /&gt;iprange3&lt;BR /&gt;iprange4&lt;BR /&gt;iprange5&lt;BR /&gt;iprange6&lt;BR /&gt;iprange7&lt;BR /&gt;iprange8&lt;BR /&gt;&lt;BR /&gt;basically the ipranges are exeptions from a report that is emailed daily.&lt;BR /&gt;&lt;BR /&gt;Thanks chaps.&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Sep 2007 06:13:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066715#M94605</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-09-03T06:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: help in removing entries from a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066716#M94606</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;# grep -v -f pattern_file data_file&lt;BR /&gt;&lt;BR /&gt;...where 'pattern_file' contains the strings that you do *not* want to include in your output.&lt;BR /&gt;&lt;BR /&gt;Please consider also evaluating your previous thread on this subject:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1156808" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1156808&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 03 Sep 2007 06:59:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066716#M94606</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-09-03T06:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: help in removing entries from a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066717#M94607</link>
      <description>Hi (again) Chris:&lt;BR /&gt;&lt;BR /&gt;Actually for *ranges* you have 'grep's ability to use extended regular expressions ('-E') in your pattern file ('-f)' [see the manpges for 'grep']:&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;# cat .pattern_file&lt;BR /&gt;10.11.*.2&lt;BR /&gt;&lt;BR /&gt;# cat .data_file&lt;BR /&gt;10.11.12.1&lt;BR /&gt;10.11.12.2&lt;BR /&gt;10.11.12.3&lt;BR /&gt;10.11.13.1&lt;BR /&gt;10.11.13.2&lt;BR /&gt;10.11.13.3&lt;BR /&gt;10.11.14.1&lt;BR /&gt;10.11.14.2&lt;BR /&gt;10.11.14.3&lt;BR /&gt;&lt;BR /&gt;# grep -v -E -f .pattern_file data_file&lt;BR /&gt;10.11.13.1&lt;BR /&gt;10.11.13.3&lt;BR /&gt;10.11.14.1&lt;BR /&gt;10.11.14.3&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Sep 2007 08:07:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066717#M94607</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-09-03T08:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: help in removing entries from a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066718#M94608</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;DISREGARD MY LAST POST!  ENOCOFFEE!  We need to escape the 'dot' if we want it to mean itself and not any character in the context I presented.&lt;BR /&gt;&lt;BR /&gt;Actually for *ranges* you have 'grep's ability to use extended regular expressions ('-E') in your pattern file ('-f)' [see the manpges for 'grep']:&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;# cat .pattern_file&lt;BR /&gt;10\.11\.[0-9]*\.2&lt;BR /&gt;&lt;BR /&gt;# cat .data_file&lt;BR /&gt;10.11.12.1&lt;BR /&gt;10.11.12.2&lt;BR /&gt;10.11.12.3&lt;BR /&gt;10.11.13.1&lt;BR /&gt;10.11.13.2&lt;BR /&gt;10.11.13.3&lt;BR /&gt;10.11.14.1&lt;BR /&gt;10.11.14.2&lt;BR /&gt;10.11.14.3&lt;BR /&gt;&lt;BR /&gt;# grep -v -E -f ./pattern_file ./data_file&lt;BR /&gt;10.11.12.1&lt;BR /&gt;10.11.12.3&lt;BR /&gt;10.11.13.1&lt;BR /&gt;10.11.13.3&lt;BR /&gt;10.11.14.1&lt;BR /&gt;10.11.14.3&lt;BR /&gt;&lt;BR /&gt;# grep -E -f ./pattern_file ./data_file&lt;BR /&gt;10.11.12.2&lt;BR /&gt;10.11.13.2&lt;BR /&gt;10.11.14.2&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 03 Sep 2007 08:48:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066718#M94608</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-09-03T08:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: help in removing entries from a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066719#M94609</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;just as JRF remarked: make yourself clear, if you want to consider 'iprange1' as string or as pattern.&lt;BR /&gt;Note, that using it as pattern creates the problem, that you have to watch for wildcard characters: something like&lt;BR /&gt;1.2.3.4&lt;BR /&gt;will match&lt;BR /&gt;152.3.4&lt;BR /&gt;as well, because '.' is 'any char' when using it in regular expressions! Best use&lt;BR /&gt;1[.]2[.]3[.]4&lt;BR /&gt;for such a case.&lt;BR /&gt;Important as well is the fact, if your pattern are anchored at begin or end of a line. Taking this into account can speed up your script dramatically!&lt;BR /&gt;&lt;BR /&gt;Second: NOT wanting a pattern match, use&lt;BR /&gt;fgrep (or grep -F) - this does pure string compares.&lt;BR /&gt;&lt;BR /&gt;mfG Peter&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Sep 2007 11:46:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066719#M94609</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-09-03T11:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: help in removing entries from a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066720#M94610</link>
      <description>Thanks all,&lt;BR /&gt;&lt;BR /&gt;I am not too familiar with fgrep or egrep however do understand these are powerful tools and will check and test out.&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
      <pubDate>Mon, 03 Sep 2007 11:59:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066720#M94610</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-09-03T11:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: help in removing entries from a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066721#M94611</link>
      <description>&amp;gt;JRF: extended regular expressions&lt;BR /&gt;&lt;BR /&gt;No need to use the -E hammer, your regular expressions (*) aren't extended.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Peter: Best use 1[.]2[.]3[.]4&lt;BR /&gt;&lt;BR /&gt;Usually they are quoted with a "\".&lt;BR /&gt;&lt;BR /&gt;&amp;gt;if your pattern are anchored at begin or end of a line. Taking this into account can speed up your script dramatically!&lt;BR /&gt;&lt;BR /&gt;Right.  You can do that with grep -x but the logfile could only have that number and no other data on each line.&lt;BR /&gt;&lt;BR /&gt;I'm surprised Peter didn't mention the gotcha with fgrep, 1.2.3.4 will match 21.2.3.4&lt;BR /&gt;&lt;BR /&gt;So you need to use grep -w, or use anchored strings in the file.  Given't JRF's file:&lt;BR /&gt;10\.11\.[0-9]*\.2 &lt;BR /&gt;&lt;BR /&gt;You could use vi to add the anchors:&lt;BR /&gt;:%s/^/^/&lt;BR /&gt;:%s/$/$/</description>
      <pubDate>Mon, 03 Sep 2007 16:47:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-in-removing-entries-from-a-file/m-p/5066721#M94611</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-09-03T16:47:19Z</dc:date>
    </item>
  </channel>
</rss>

