10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
A process xyz is running and creating file1, file2, file3, .... filen. how do i know if the process has stopped and createtime of the last file (filen) is older than 5 minutes?
OS is AIX (3 Replies)
Discussion started by: malaika
3 Replies
2. Shell Programming and Scripting
I wanted to send an email to the client whenever there is failed record created in a /feed/HR-76/failed folder after processing of feed file.
I can find out with the help of below script that what is the new file created but that file didn't make just 15 minutes before.
... (1 Reply)
Discussion started by: puneetkhullar
1 Replies
3. Shell Programming and Scripting
Hi All,
I have scenario where I need to zip huge number of DB audit log files newer than 90 days and delete anything older than that. If the files are too huge in number,zipping will take long time and causing CPU spikes. To avoid this I wanted to segregate files based on how old they are and... (2 Replies)
Discussion started by: veeresh_15
2 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I'm running atq for a user and its showing 2 'at' jobs in the queue to start at a later time.
> atq
Is there any way i can find out the creation date/time of these jobs?
and ideally what job created them and what script(s) they are going to run?
All i can see is the job number and... (3 Replies)
Discussion started by: finn
3 Replies
5. Shell Programming and Scripting
Hello Gurus,
I am facing one issue to get a file for a specific time. There are about 300 files created between 6.30 pm to 7.15 pm everyday.
Now I wanted only the file which is created on 6.45pm. No other files required.
I have used "find" command to get the files, but not getting the expected... (3 Replies)
Discussion started by: pokhraj_d
3 Replies
6. Shell Programming and Scripting
Hi
I have a system running uname -a
Linux cmovel-db01 2.6.32-38-server #83-Ubuntu SMP Wed Jan 4 11:26:59 UTC 2012 x86_64 GNU/Linux
I would like to capture the contents of /var/log/syslog from 11:00AM to 11:30AM and sent to this info via email.
I was thinking in set a cron entry at that... (2 Replies)
Discussion started by: fretagi
2 Replies
7. UNIX for Dummies Questions & Answers
I am using RHEL.
I wan to know the creation time of one user?
which command? (4 Replies)
Discussion started by: cqlouis
4 Replies
8. UNIX for Advanced & Expert Users
I have lot .log files in a directory.I need to take the one got created today.Is there any way to get the time of creation of a file? (6 Replies)
Discussion started by: yakyaj
6 Replies
9. Shell Programming and Scripting
Hi guys
I need to find out a file created at 'x' time and the name of the file is rag.rxt
100's of these files are created every minute and i dont know how to find the file created at a particular time. pls help me with the command to search that.
thanks in advance (2 Replies)
Discussion started by: ragha81
2 Replies
10. Shell Programming and Scripting
Can I determine when the particular file was created, in korn-shell. Can please someone help me. If possible please mail the solution to me.
my mail id: bharat.surana@gmail.com (1 Reply)
Discussion started by: BharatSurana
1 Replies
IO::Capture::Stdout(3pm) User Contributed Perl Documentation IO::Capture::Stdout(3pm)
NAME
IO::Capture::Stdout - Capture any output sent to STDOUT
SYNOPSIS
# Generic example (Just to give the overall view)
use IO::Capture::Stdout;
$capture = IO::Capture::Stdout->new();
$capture->start(); # STDOUT Output captured
print STDOUT "Test Line One
";
print STDOUT "Test Line Two
";
print STDOUT "Test Line Three
";
$capture->stop(); # STDOUT output sent to wherever it was before 'start'
# In 'scalar context' returns next line
$line = $capture->read;
print "$line"; # prints "Test Line One"
$line = $capture->read;
print "$line"; # prints "Test Line Two"
# move line pointer to line 1
$capture->line_pointer(1);
$line = $capture->read;
print "$line"; # prints "Test Line One"
# Find out current line number
$current_line_position = $capture->line_pointer;
# In 'List Context' return an array(list)
@all_lines = $capture->read;
# More useful example 1 - "Using in module tests"
# Note: If you don't want to make users install
# the IO::Capture module just for your tests,
# you can just install in the t/lib directory
# of your module and use the lib pragma in
# your tests.
use lib "t/lib";
use IO::Capture::Stdout;
use Test::More;
my $capture = IO::Capture::Stdout->new;
$capture->start
# execute with a bad parameter to make sure get
# an error.
ok( ! $test("Bad Parameter") );
$capture->stop();
DESCRIPTION
The module "IO::Capture::Stdout", is derived from the abstract class "IO::Capture". See IO::Capture. The purpose of the module (as the
name suggests) is to capture any output sent to "STDOUT". After the capture is stopped, the STDOUT filehandle will be reset to the previ-
ous location. E.g., If previously redirected to a file, when "IO::Capture->stop" is called, output will start going into that file again.
Note: This module won't work with the perl function, system(), or any other operation
involving a fork(). If you want to capture the output from a system command,
it is faster to use open() or back-ticks.
my $output = `/usr/sbin/ls -l 2>&1`;
METHODS
new
o Creates a new capture object.
o An object can be reused as needed, so will only need to do one of these.
o Be aware, any data previously captured will be discarded if a new capture session is started.
start
o Start capturing data into the "IO::Capture" Object.
o Can not be called on an object that is already capturing.
o Can not be called while STDOUT tied to an object.
o "undef" will be returned on an error.
stop
o Stop capturing data and point STDOUT back to it's previous output location I.e., untie STDOUT
read
o In Scalar Context
o Lines are read from the buffer at the position of the "line_pointer", and the pointer is incremented by one.
$next_line = $capture->read;
o In List Context
o The array is returned. The "line_pointer" is not affected.
@buffer = $capture->read;
o Data lines are returned exactly as they were captured. You may want to use "chomp" on them if you don't want the end of line charac-
ter(s)
while (my $line = $capture->read) {
chomp $line;
$cat_line = join '', $cat_line, $line;
}
line_pointer
o Reads or sets the "line_pointer".
my $current_line = $capture->line_pointer;
$capture->line_pointer(1);
SUB-CLASSING
Adding Features
If you would like to sub-class this module to add a feature (method) or two, here is a couple of easy steps. Also see IO::Capture::Over-
view.
1 Give your package a name
package MyPackage;
2 Use this "IO::Capture::Stdout" as your base class like this:
package MyPackage;
use base qw/IO::Capture::Stdout/;
3 Add your new method like this
package MyPackage;
use base qw/IO::Capture::Stdout/;
sub grep {
my $self = shift;
for $line (
}
See Also
IO::Capture::Overview
IO::Capture
IO::Capture::Stderr
AUTHORS
Mark Reynolds reynolds@sgi.com
Jon Morgan jmorgan@sgi.com
COPYRIGHT
Copyright (c) 2003, Mark Reynolds. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under
the same terms as Perl itself.
perl v5.8.8 2007-07-30 IO::Capture::Stdout(3pm)