Sponsored Content
Full Discussion: Help with ksh shell script
Top Forums Shell Programming and Scripting Help with ksh shell script Post 302536955 by mirni on Wednesday 6th of July 2011 04:06:27 PM
Old 07-06-2011
You can sort on second field using underscore as delimiter :
Code:
ls * | sort -t_ -k2

That is provided that filename before date doesnt contain underscore.
This User Gave Thanks to mirni For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mailx in shell script (KSH)

Greetings all, I'm pretty new to the use of mailx, having been using mutt most of the time. I'm interested to know how I can use mailx within a shell script to send out a formatted email with the following criterion: 1. My recipient's address is abcdef1000@gmail.com 2. The message body is... (2 Replies)
Discussion started by: rockysfr
2 Replies

2. Shell Programming and Scripting

ssh into a shell script (KSH)

Hi all, Just like to ask if it is possible to do the following: 1. Have a shell script that calls ssh username@destinationhost 2. Upon successful verification, we ssh into the destination host and automatically use ksh to run a shell script that resides in the destination host. (Hopefully no... (8 Replies)
Discussion started by: rockysfr
8 Replies

3. Shell Programming and Scripting

Awk in ksh shell script - help

Hello, Im a beginner. Im writing a ksh script with awk. Is it possible to assign the output of the awk to a shell variable? Like, shell_variable= awk '$1 == "shell" {abc= $2 }' /tmp/cust_det echo $shell_variable Please excuse my ignorance. Thanks in advance. (4 Replies)
Discussion started by: Nic_writes
4 Replies

4. Shell Programming and Scripting

Help with ksh shell script

I am using /usr/bin/ksh in AIX I am reading the values of $dbname, $dbatmpdir/dbdir.$$, and $scope from a different file All I have to do is check if $dbname exists in file $dbatmpdir/dbdir.$$ and $scope should have a value either 'TABLE' or 'SCHEMA'. When I execute the following code. I am... (3 Replies)
Discussion started by: tenderfoot
3 Replies

5. Shell Programming and Scripting

what does this ksh shell script do?

Can someone tell me when the script is called, what does it do? I can't see it is going to run anything. (1 Reply)
Discussion started by: dp100022
1 Replies

6. Shell Programming and Scripting

How can I execute another shell from my ksh script?

I am newbie in UNIX, so please excuse me for the stupid question.:) Here is a problem: I created ksh script where the part of the functionality include an opening of a second session with another shell process "runrep"(runrep is a custom reporting shell designed by Advent Geneva). When I run my... (3 Replies)
Discussion started by: alexstar
3 Replies

7. Shell Programming and Scripting

Array in Ksh Shell script

hi team, i have a file, which contains only variable and its value param.ksh --------- export A=123 export B=345 export C=567 export D=OPLI export E=OL89PO From shell script, i am invoking this file and use the value of this variable. Now there are 5 variable in above file. Before i... (1 Reply)
Discussion started by: ace_friends22
1 Replies

8. UNIX for Dummies Questions & Answers

How do i lock a ksh shell script?

Hi, I have a ksh shell script that accesses databases to drop and create tables and the script also creates text files. This shell script is accessed thru a java application that i would like to turn multi-user, but the only way that i can do that is if I can figure out a way to lock the shell... (2 Replies)
Discussion started by: ndedhia1
2 Replies

9. Shell Programming and Scripting

Help with KSH Shell Script

From a shell script I'm trying to remove the first two files of whats returned from the head -2 command so I tried piping it to xargs rm -f but I can't get it to work. How do I remove the files from the head command? ls -al *clit* *servr* |sort -t_ -nk2 | head -2 |xargs rm -f (3 Replies)
Discussion started by: Bperl1967
3 Replies

10. Shell Programming and Scripting

Help with ksh Shell Script

My goal is to create a script that will check if in a test or production environment. I wrote this script to check $host variable to check which server I'm on but this script does not work. if then BASE=/home/fmtest; export BASE else BASE=/home/fmprod; export BASE fi ... (5 Replies)
Discussion started by: Bperl1967
5 Replies
Class::Inspector(3)					User Contributed Perl Documentation				       Class::Inspector(3)

NAME
Class::Inspector - Get information about a class and its structure SYNOPSIS
use Class::Inspector; # Is a class installed and/or loaded Class::Inspector->installed( 'Foo::Class' ); Class::Inspector->loaded( 'Foo::Class' ); # Filename related information Class::Inspector->filename( 'Foo::Class' ); Class::Inspector->resolved_filename( 'Foo::Class' ); # Get subroutine related information Class::Inspector->functions( 'Foo::Class' ); Class::Inspector->function_refs( 'Foo::Class' ); Class::Inspector->function_exists( 'Foo::Class', 'bar' ); Class::Inspector->methods( 'Foo::Class', 'full', 'public' ); # Find all loaded subclasses or something Class::Inspector->subclasses( 'Foo::Class' ); DESCRIPTION
Class::Inspector allows you to get information about a loaded class. Most or all of this information can be found in other ways, but they aren't always very friendly, and usually involve a relatively high level of Perl wizardry, or strange and unusual looking code. Class::Inspector attempts to provide an easier, more friendly interface to this information. METHODS
installed $class The "installed" static method tries to determine if a class is installed on the machine, or at least available to Perl. It does this by wrapping around "resolved_filename". Returns true if installed/available, false if the class is not installed, or "undef" if the class name is invalid. loaded $class The "loaded" static method tries to determine if a class is loaded by looking for symbol table entries. This method it uses to determine this will work even if the class does not have its own file, but is contained inside a single file with multiple classes in it. Even in the case of some sort of run-time loading class being used, these typically leave some trace in the symbol table, so an Autoload or Class::Autouse-based class should correctly appear loaded. Returns true if the class is loaded, false if not, or "undef" if the class name is invalid. filename $class For a given class, returns the base filename for the class. This will NOT be a fully resolved filename, just the part of the filename BELOW the @INC entry. print Class->filename( 'Foo::Bar' ); > Foo/Bar.pm This filename will be returned with the right seperator for the local platform, and should work on all platforms. Returns the filename on success or "undef" if the class name is invalid. resolved_filename $class, @try_first For a given class, the "resolved_filename" static method returns the fully resolved filename for a class. That is, the file that the class would be loaded from. This is not nescesarily the file that the class WAS loaded from, as the value returned is determined each time it runs, and the @INC include path may change. To get the actual file for a loaded class, see the "loaded_filename" method. Returns the filename for the class, or "undef" if the class name is invalid. loaded_filename $class For a given loaded class, the "loaded_filename" static method determines (via the %INC hash) the name of the file that it was originally loaded from. Returns a resolved file path, or false if the class did not have it's own file. functions $class For a loaded class, the "functions" static method returns a list of the names of all the functions in the classes immediate namespace. Note that this is not the METHODS of the class, just the functions. Returns a reference to an array of the function names on success, or "undef" if the class name is invalid or the class is not loaded. function_refs $class For a loaded class, the "function_refs" static method returns references to all the functions in the classes immediate namespace. Note that this is not the METHODS of the class, just the functions. Returns a reference to an array of "CODE" refs of the functions on success, or "undef" if the class is not loaded. function_exists $class, $function Given a class and function name the "function_exists" static method will check to see if the function exists in the class. Note that this is as a function, not as a method. To see if a method exists for a class, use the "can" method for any class or object. Returns true if the function exists, false if not, or "undef" if the class or function name are invalid, or the class is not loaded. methods $class, @options For a given class name, the "methods" static method will returns ALL the methods available to that class. This includes all methods available from every class up the class' @ISA tree. Returns a reference to an array of the names of all the available methods on success, or "undef" if the class name is invalid or the class is not loaded. A number of options are available to the "methods" method that will alter the results returned. These should be listed after the class name, in any order. # Only get public methods my $method = Class::Inspector->methods( 'My::Class', 'public' ); public The "public" option will return only 'public' methods, as defined by the Perl convention of prepending an underscore to any 'private' methods. The "public" option will effectively remove any methods that start with an underscore. private The "private" options will return only 'private' methods, as defined by the Perl convention of prepending an underscore to an private methods. The "private" option will effectively remove an method that do not start with an underscore. Note: The "public" and "private" options are mutually exclusive full "methods" normally returns just the method name. Supplying the "full" option will cause the methods to be returned as the full names. That is, instead of returning "[ 'method1', 'method2', 'method3' ]", you would instead get "[ 'Class::method1', 'AnotherClass::method2', 'Class::method3' ]". expanded The "expanded" option will cause a lot more information about method to be returned. Instead of just the method name, you will instead get an array reference containing the method name as a single combined name, ala "full", the seperate class and method, and a CODE ref to the actual function ( if available ). Please note that the function reference is not guarenteed to be available. "Class::Inspector" is intended at some later time, work with modules that have some some of common run-time loader in place ( e.g "Autoloader" or "Class::Autouse" for example. The response from "methods( 'Class', 'expanded' )" would look something like the following. [ [ 'Class::method1', 'Class', 'method1', &Class::method1 ], [ 'Another::method2', 'Another', 'method2', &Another::method2 ], [ 'Foo::bar', 'Foo', 'bar', &Foo::bar ], ] subclasses $class The "subclasses" static method will search then entire namespace (and thus all currently loaded classes) to find all classes that are subclasses of the class provided as a the parameter. The actual test will be done by calling "isa" on the class as a static method. (i.e. "My::Class->isa($class)". Returns a reference to a list of the loaded classes that match the class provided, or false is none match, or "undef" if the class name provided is invalid. SUPPORT
Bugs should be reported via the CPAN bug tracker <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-Inspector> For other issues, or commercial enhancement or support, contact the author. AUTHOR
Adam Kennedy <adamk@cpan.org> SEE ALSO
<http://ali.as/>, Class::Handle COPYRIGHT
Copyright 2002 - 2012 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.18.2 2012-10-19 Class::Inspector(3)
All times are GMT -4. The time now is 11:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy