I have been able to make some progress on the problem. I found a partial solution, but I can't
post the links yet.
Here is the code:
I made a change to the printf statement to:
With this change I get a comma separated list of crtime (creation time) and names of the files
in the current directory.
The problem with this is that the files are not sorted by crtime.
I found code that solved the sort problem, but I don't know how to change the printf statements to get a comma separted list of crtime and name:
Here is the code I found:
The second program sorts by crtime, but I don't know enough about
Bash programming to figure out how to get i displayed as a comma separated list.
If anyone understands this code and has the time to explain it line by line, I believe it
will help me as well as the community.
Hi All
I was wondering what is the most efficient way to find files in the current directory(that may contain 100,000's files), that meets a certain specified file type and of a certain age.
I have experimented with the find command in unix but it also searches all sub directories. I have... (2 Replies)
Hello,
Using the instruction mget (within ftp) and with "Interactive mode off", I want to get all files from directory (DirAA), but not the files in sub-directories.
The files names don't follow any defined rule, so they can be just letters without (.) period
Directory structure example: ... (0 Replies)
i am trying to write a program, that will list .txt files and .png files.
it will ask the user what type of files do they want to list! so if the user inputs txt files.. how would you list all the .txt files in the current directory (the directory the program is running)!!
thanks (1 Reply)
Hi,
I need to find the list of matching direcories in current folder only and no subfolders on AIX.I tried -maxdepth option but its not working.
Also, tried ls -d option to list the matching directories but getting argument list too long...
So, any help would be appreciated. (6 Replies)
Can anyone come up with a unix command that lists
all the files, directories and sub-directories in the current directory
except a folder called log.?
Thank you in advance. (7 Replies)
Hi,
I have to find specific files only in the current directory...not in the sub directories.
But when I use Find command ... it searches all the files in the current directory as well as in the subdirectories. I am using AIX-UNIX machine.Please help..
I am using the below command. And i am... (2 Replies)
It is for HP-Unix B.11.31.
Requirement:
1. List the directories, having given pattern in the directories name, sorted by creation date.
Example: Directories with name "pkg32*" or "pkg33*"
2. On the output of 1. list the directories by creation date as sort order, with creation date... (2 Replies)
Find all files in the current directory only excluding hidden directories and files.
For the below command, though it's not deleting hidden files.. it is traversing through the hidden directories and listing normal which should be avoided.
`find . \( ! -name ".*" -prune \) -mtime +${n_days}... (7 Replies)
Hi All,
I have a list of words (these are actually a list of database table names separated by comma).
Now, I want to find only the non-existing list of words in the *.java files of current directory and/or its sub-directories.
Sample list of words:... (8 Replies)
Discussion started by: Bhanu Dhulipudi
8 Replies
LEARN ABOUT SUNOS
kstat
Kstat(3PERL)Kstat(3PERL)NAME
Kstat - Perl tied hash interface to the kstat facility
SYNOPSIS
use Sun::Solaris::Kstat;
Sun::Solaris::Kstat->new();
Sun::Solaris::Kstat->update();
Sun::Solaris::Kstat->{module}{instance}{name}{statistic}
Kernel statistics are categorized using a 3-part key consisting of the module, the instance, and the statistic name. For example, CPU
information can be found under cpu_stat:0:cpu_stat0, as in the above example. The method Sun::Solaris::Kstat->new() creates a new 3-layer
tree of Perl hashes with the same structure; that is, the statistic for CPU 0 can be accessed as $ks->{cpu_stat}{0}{cpu_stat0}. The fourth
and lowest layer is a tied hash used to hold the individual statistics values for a particular system resource.
For performance reasons, the creation of a Sun::Solaris::Kstat object is not accompanied by a following read of all possible statistics.
Instead, the 3-layer structure described above is created, but reads of a statistic's values are done only when referenced. For example,
accessing $ks->{cpu_stat}{0}{cpu_stat0}{syscall} will read in all the statistics for CPU 0, including user, system, and wait times, and the
other CPU statistics, as well as the number of system call entries. Once you have accessed a lowest level statistics value, calling
$ks->update() will automatically update all the individual values of any statistics you have accessed.
There are two values of the lowest-level hash that can be read without causing the full set of statistics to be read from the kernel. These
are "class", which is the kstat class of the statistics, and "crtime"n, which is the time that the kstat was created. See kstat(3KSTAT)
for full details of these fields.
Methods
new() Create a new kstat statistics hierarchy and return a reference to the top-level hash. Use it like any normal hash to access
the statistics.
update() Update all the statistics that have been accessed so far. In scalar context, update() returns 1 if the kstat structure has
changed, and 0 otherwise. In list context, update() returns references to two arrays: the first holds the keys of any
kstats that have been added, and the second holds the keys of any kstats that have been deleted. Each key will be returned
in the form "module:instance:name".
Example 1: Sun::Solaris::Kstat example
use Sun::Solaris::Kstat;
my $kstat = Sun::Solaris::Kstat->new();
my ($usr1, $sys1, $wio1, $idle1) =
@{$kstat->{cpu_stat}{0}{cpu_stat0}}{qw(user kernel wait idle)};
print("usr sys wio idle
");
while(1) {
sleep 5;
if ($kstat->update()) {
print("Configuration changed
");
}
my ($usr2, $sys2, $wio2, $idle2) =
@{$kstat->{cpu_stat}{0}{cpu_stat0}}{qw(user kernel wait idle)};
printf(" %.2d %.2d %.2d %.2d
",
($usr2 - $usr1) / 5, ($sys2 - $sys1) / 5,
($wio2 - $wio1) / 5, ($idle2 - $idle1) / 5);
$usr1 = $usr2;
$sys1 = $sys2;
$wio1 = $wio2;
$idle1 = $idle2;
}
perl(1), kstat(1M), kstat(3KSTAT), kstat_chain_update(3KSTAT), kstat_close(3KSTAT), kstat_open(3KSTAT), kstat_read(3KSTAT)
As the statistics are stored in a tied hash, taking additional references of members of the hash, such as
my $ref = ks->{cpu_stat}{0}{cpu_stat0}{syscall};
print("$$ref
");
will be recorded as a hold on that statistic's value, preventing it from being updated by refresh(). Copy the values explicitly if persis-
tence is necessary.
Several of the statistics provided by the kstat facility are stored as 64-bit integer values. Perl 5 does not yet internally support 64-bit
integers, so these values are approximated in this module. There are two classes of 64-bit value to be dealt with:
64-bit intervals and timThese are the crtime and snaptime fields of all the statistics hashes, and the wtime, wlentime, wlastupdate, rtime,
rlentime and rlastupdate fields of the kstat I/O statistics structures. These are measured by the kstat facility
in nanoseconds, meaning that a 32-bit value would represent approximately 4 seconds. The alternative is to store
the values as floating-point numbers, which offer approximately 53 bits of precision on present hardware. 64-bit
intervals and timers as floating point values expressed in seconds, meaning that time-related kstats are being
rounded to approximately microsecond resolution.
64-bit counters It is not useful to store these values as 32-bit values. As noted above, floating-point values offer 53 bits of
precision. Accordingly, all 64-bit counters are stored as floating-point values.
21 Jul 2005 Kstat(3PERL)