use strict;
use warnings;
while( <DATA> ){
last if /^Status of the log/;
}
my @lines = do { local $/; <DATA> };
print @lines;
__DATA__
hostname
06-NOV-13
log status
Status of the log
1 248641
2 211749
3 246008
4 262190
5 175450
| [reply] [d/l] |
perl -ne 'push @arr,$_ if m/^Status of the log/..undef}{print for @ar
+r' Your-log-file-name.here
(ab)uses the flip-flop operator. See "Range operator" in http://perldoc.perl.org/perlop.html.
When in doubt, mumble; when in trouble, delegate; when in charge, ponder. -- James H. Boren
| [reply] [d/l] |
| [reply] |
It is against the spirit of this site to request someone to write code for you without any attempt on your part, because the main purpose is education, which usually requires effort on the part of the recipient.
That said, here is some code that will do the job, but I'm hoping you will try to understand how it works, and if you have difficulty with that, please post specific questions explaining how much you have understood, and what part you have difficulty with.
perl -ne 'push @arr,$_ if $x;$x||=m/^Status of the log/}{print for @a
+rr' Your-file.name
Note - the only reason the code contains a "push @arr" is because you originally requested the contents be placed in an array.
When in doubt, mumble; when in trouble, delegate; when in charge, ponder. -- James H. Boren
| [reply] [d/l] |
I want to get all lines after status of the log to end of the line Do you mean perhaps "end of the file"?
CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James My blog: Imperial Deltronics
| [reply] |
my $print_this = 0;
while (<$IN>) {
print if $print_this;
$print_this = 1 if /^Status of the log/;
}
| [reply] [d/l] |