<?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 script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/perl-script/m-p/3820345#M100267</link>
    <description>However much I love perl, why not use split or csplit here?&lt;BR /&gt;The right tool for the right problem.&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
    <pubDate>Mon, 10 Jul 2006 04:16:21 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2006-07-10T04:16:21Z</dc:date>
    <item>
      <title>perl script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-script/m-p/3820344#M100266</link>
      <description>Hi...&lt;BR /&gt;&lt;BR /&gt;I wanted split a file and move certain no of lines from that file to another.&lt;BR /&gt;&lt;BR /&gt;i.e I need to take out first 800 lines in a file and move to a new file and then the next 800 to another new file,etc...&lt;BR /&gt;&lt;BR /&gt;I wrote the below coding,but I could not take out the line from the old file...plz help me out in finding the mistake in my code&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my $logfiles_dir_path = '/home/rsaravanan/rekha/assignments/log';&lt;BR /&gt;opendir DH, $logfiles_dir_path or die "Cannot open dir $logfiles_dir_path : $!";&lt;BR /&gt;foreach my $logfilename (readdir DH) &lt;BR /&gt;{&lt;BR /&gt; my $logfile = $logfiles_dir_path .'/'.$logfilename;&lt;BR /&gt; open(FH, $logfile) or die "Can't open $logfile: $!";;&lt;BR /&gt; my @file_lines = &lt;FH&gt;;&lt;BR /&gt; close(FH);&lt;BR /&gt; my $line_count = 0;&lt;BR /&gt; while (@file_lines)&lt;BR /&gt; {&lt;BR /&gt;  my $i = 1;&lt;BR /&gt;  #my $line_count = 0;&lt;BR /&gt;  my $new_filepath = $logfiles_dir_path .'/'.$logfilename.'.'.'file'.$i;&lt;BR /&gt;  open DATAOUT, "&amp;gt;&amp;gt;$new_filepath" or die "can't open $new_filepath $!";&lt;BR /&gt;  #until($line_count == 5)&lt;BR /&gt;  #{&lt;BR /&gt;   foreach my $line (@file_lines)&lt;BR /&gt;   {&lt;BR /&gt;    my $out = shift @file_lines;&lt;BR /&gt;    #print $out;&lt;BR /&gt;    print DATAOUT "$out";   &lt;BR /&gt;             &lt;BR /&gt;                        }&lt;BR /&gt;   # $line_count++;&lt;BR /&gt;   &lt;BR /&gt;   # }&lt;BR /&gt;  close(DATAOUT);&lt;BR /&gt;  $i++;&lt;BR /&gt;  &lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt;} &lt;BR /&gt;close(DH);&lt;BR /&gt;&lt;BR /&gt;&lt;/FH&gt;</description>
      <pubDate>Mon, 10 Jul 2006 04:09:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-script/m-p/3820344#M100266</guid>
      <dc:creator>Sasirekha</dc:creator>
      <dc:date>2006-07-10T04:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: perl script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-script/m-p/3820345#M100267</link>
      <description>However much I love perl, why not use split or csplit here?&lt;BR /&gt;The right tool for the right problem.&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 10 Jul 2006 04:16:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-script/m-p/3820345#M100267</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-07-10T04:16:21Z</dc:date>
    </item>
  </channel>
</rss>

