Hi,
I am new to Unix shell scripting. Can you please help me with this immediate requirement to code.. The requirement is as given below.
In a directory say Y, I have files like this.
PP_100000_28062006_122731_746.dat
PP_100000_28062006_122731_745.dat
PP_100000_28062006_122734_745.dat... (4 Replies)
hello
i have a requirement where i have a direcotry in which i get files in the format
STOCKS.20080114.dat
STOCKS.20080115.dat
STOCKS.20080117.dat
STOCKS.20080118.dat
i need to loop through the directory and sort by create date descending order and i need to process the first file.
... (1 Reply)
hello people
i need your help please
i want to achieve the following with the simplest, most efficient shell-tools:
i have a directory with a lot of files from users.
the script should check which partition the dir is on
if the partition with the directory is more than 90% full
... (2 Replies)
Hi all,
i'm new here in this forum. I really like the helpful answers in this forum.
Here a short question.
For a script i have to sort files by date and exclude the files of the actual date.
Sorting the files by date and preparing the output for awk is done by this line:
ls -l... (3 Replies)
:cool:
Hi all,
I have a pecular issue in sorting these files in Solaris environment.
All the below files are modified on November 4th, but I want to sort these files as per date column (eg: 01May07_1623 = ddmmmyy_hhmm)
Nov 4 18:27 SONYELEC00.GI22973.01May07_1623.gpg
Nov 4 18:27... (4 Replies)
hi there,
I have a directory which contents I can parse dynamically. I end up with a file list. I then want to display those files sorted by date, oldest files first. I have very very little PERL experience...Would anyone know how to do that ? Thanks in advance. (8 Replies)
Hi, I am a newbie to shell programming and I need some help in sorting a list of files in ascending order of date in the filenames.
The file format is always : IGL01_AC_D_<YYYYMMDD>_N01_01
For example, in a directory MyDirectory I have the following files:
IGL01_AC_D_20110712_N01_01.dat... (11 Replies)
Hi Experts,
I have a filelist collected from another server , now want to sort the output using date/time stamp filed.
- Filed 6, 7,8 are showing the date/time/stamp.
Here is the input:
#----------------------------------------------------------------------
-rw------- 1 root ... (3 Replies)
Hi I have a problem, I have a large group of archive files in a folder some are later versions of the same archive, the only difference btween them is that the archiving program we use appends the name with a code for it to keep track of in its data base, and the modification date.
I am starting... (6 Replies)
Hi,
I'm an absolute beginner in shell programming.
I would need a script for a NAS that makes the csv files sorted by date and always monthly a zip.
In the current month, the data should be integrated into this folder, so there are only monthly files.
Thanks for your help (1 Reply)
Discussion started by: Pipo
1 Replies
LEARN ABOUT DEBIAN
monkey::patch
Monkey::Patch(3pm) User Contributed Perl Documentation Monkey::Patch(3pm)NAME
Monkey::Patch - Scoped monkeypatching (you can at least play nice)
VERSION
version 0.03
SYNOPSIS
use Monkey::Patch qw(:all);
sub some_subroutine {
my $pkg = patch_class 'Some::Class' => 'something' => sub {
my $original = shift;
say "Whee!";
$original->(@_);
};
Some::Class->something(); # says Whee! and does whatever
undef $pkg;
Some::Class->something(); # no longer says Whee!
my $obj = Some::Class->new;
my $obj2 = Some::Class->new;
my $whoah = patch_object $obj, 'twiddle' => sub {
my $original = shift;
my $self = shift;
say "Whoah!";
$self->$original(@_);
};
$obj->twiddle(); # says Whoah!
$obj2->twiddle(); # doesn't
$obj->twiddle() # still does
undef $whoah;
$obj->twiddle(); # but not any more
SUBROUTINES
The following subroutines are available (either individually or via :all)
patch_package (package, subname, code)
Wraps "package"'s subroutine named <subname> with your <code>. Your code recieves the original subroutine as its first argument, followed
by any arguments the subroutine would have normally gotten. You can always call the subroutine ref your received; if there was no
subroutine by that name, the coderef will simply do nothing.
patch_class (class, methodname, code)
Just like "patch_package", except that the @ISA chain is walked when you try to call the original subroutine if there wasn't any subroutine
by that name in the package.
patch_object (object, methodname, code)
Just like "patch_class", except that your code will only get called on the object you pass, not the entire class.
HANDLES
All the "patch" functions return a handle object. As soon as you lose the value of the handle (by calling in void context, assigning over
the variable, undeffing the variable, letting it go out of scope, etc), the monkey patch is unwrapped. You can stack monkeypatches and let
go of the handles in any order; they obey a stack discipline, and the most recent valid monkeypatch will always be called. Calling the
"original" argument to your wrapper routine will always call the next-most-recent monkeypatched version (or, the original subroutine, of
course).
BUGS
This magic is only faintly black, but mucking around with the symbol table is not for the faint of heart. Help make this module better by
reporting any strange behavior that you see!
perl v5.10.1 2010-07-16 Monkey::Patch(3pm)