<?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: perl scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964934#M119173</link>
    <description>the last part is not needed, nor are the braces and some line noise&lt;BR /&gt;&lt;BR /&gt;# perl -ne '/^matched/ and$n=5;--$n and print' logfile&lt;BR /&gt;&lt;BR /&gt;does exactly the same. S.K.'s explanation is perfect.&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Sat, 03 May 2003 08:59:43 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2003-05-03T08:59:43Z</dc:date>
    <item>
      <title>perl scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964928#M119167</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Could some pls. explain what this piece of code does?&lt;BR /&gt;&lt;BR /&gt;perl -ne '{$n=5 if /^matched/;$n--,print $_ if $n;$n=0 if eof}'  logfile&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Fri, 02 May 2003 18:40:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964928#M119167</guid>
      <dc:creator>SAM_24</dc:creator>
      <dc:date>2003-05-02T18:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: perl scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964929#M119168</link>
      <description>It looks for a particular string at the beginning of a line in a log file.&lt;BR /&gt;&lt;BR /&gt;I think.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 02 May 2003 18:47:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964929#M119168</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-05-02T18:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: perl scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964930#M119169</link>
      <description>n=5&lt;BR /&gt;if "match" found at start of line then &lt;BR /&gt;n-- i.e n=4&lt;BR /&gt;print line &lt;BR /&gt;&lt;BR /&gt;then I am confuse. may be running until end of logfile&lt;BR /&gt;&lt;BR /&gt;Sachin</description>
      <pubDate>Fri, 02 May 2003 19:07:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964930#M119169</guid>
      <dc:creator>Sachin Patel</dc:creator>
      <dc:date>2003-05-02T19:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: perl scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964931#M119170</link>
      <description>It looks at logfile and sets $n to 5 every time it sees a line starting with 'matched'.  It then decrements $n to 4 and prints the line.  Every following line is printed and $n is decremented until $n is zero.  Keep in mind that $n is decremented before the print.  All lines are then ignored (not printed) until another line beginning with 'matched' is found.</description>
      <pubDate>Fri, 02 May 2003 19:13:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964931#M119170</guid>
      <dc:creator>Josh Owings</dc:creator>
      <dc:date>2003-05-02T19:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: perl scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964932#M119171</link>
      <description>I forgot to give a possible use.  &lt;BR /&gt;&lt;BR /&gt;Suppose you have a log file that you always need a set of 5 lines where the first line always begins with 'matched' (or anything you put in the /'s), but the other lines vary.  This would be a good way to only grab those sets of lines that you need without having to search through the rest of the logfile.</description>
      <pubDate>Fri, 02 May 2003 19:17:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964932#M119171</guid>
      <dc:creator>Josh Owings</dc:creator>
      <dc:date>2003-05-02T19:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: perl scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964933#M119172</link>
      <description>What it does (I think) is it'll go through line by line, when it sees the first line that starts with the word "matched" it'll print that line. Subsequently it'll keep printing the next 4 lines (assuming those lines do not start with the word "matched") and ignore the rest until it finds the next line starting with "matched". That will continue until eof. Example ..&lt;BR /&gt;logfile&lt;BR /&gt;=======&lt;BR /&gt;1 hello there&lt;BR /&gt;2 matched me&lt;BR /&gt;3 noway I am doing this&lt;BR /&gt;4 plese let me go&lt;BR /&gt;5 jump&lt;BR /&gt;6 let me go&lt;BR /&gt;7 dont do it&lt;BR /&gt;8 matched me number 2&lt;BR /&gt;9 hello again&lt;BR /&gt;10 matched me number 3&lt;BR /&gt;11 noway U are buying this&lt;BR /&gt;12 matched&lt;BR /&gt;13 no-way I am doing this&lt;BR /&gt;14 please let me go&lt;BR /&gt;15 jump&lt;BR /&gt;16 let me go&lt;BR /&gt;17 dont do it&lt;BR /&gt;18 matched&lt;BR /&gt;19 matched&lt;BR /&gt;The output would be lines&lt;BR /&gt;2,3,4,5,6,8,9,10,11,12,13,14,15,16,18,19</description>
      <pubDate>Fri, 02 May 2003 19:32:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964933#M119172</guid>
      <dc:creator>S.K. Chan</dc:creator>
      <dc:date>2003-05-02T19:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: perl scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964934#M119173</link>
      <description>the last part is not needed, nor are the braces and some line noise&lt;BR /&gt;&lt;BR /&gt;# perl -ne '/^matched/ and$n=5;--$n and print' logfile&lt;BR /&gt;&lt;BR /&gt;does exactly the same. S.K.'s explanation is perfect.&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 03 May 2003 08:59:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-scripting/m-p/2964934#M119173</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-05-03T08:59:43Z</dc:date>
    </item>
  </channel>
</rss>

