Sponsored Content
Top Forums Shell Programming and Scripting How to sort list of directories in descending order in perl? Post 303042943 by venkatesh on Monday 13th of January 2020 02:34:41 AM
Old 01-13-2020
How to sort list of directories in descending order in perl?

Hi,
I have a problem . I have few directories like inpTDT_1, inpTDT_2, inpTDT_3 and so on inside HOME directory . In one of my perl script (which is in my HOME), the above directories like inpTDT_1, inpTDT_2, inpTDT_3 are sorting out in an order So I wanted to sort all the inpTDT_1, inpTDT_2, inpTDT_3 and so on directories in Descending order . based on _* Value .How can I do that ???
Please give fast Response.

FYI,
Code:
foreach $regress_dir (<$wdir/regress_*>) {
        if (-e "$regress_dir/$vdb_dir") {
            $cov_dirs = sprintf "$regress_dir/$vdb_dir $cov_dirs";
            print "Regress_directories are $cov_dirs and loop_variable is $regress_dir \n";
} else {}


Last edited by RavinderSingh13; 01-13-2020 at 05:08 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to see disk usage in descending order

What is the command used by sysadmin to see the disk used by the users in descending order of their disk usage? (8 Replies)
Discussion started by: asutoshch
8 Replies

2. Shell Programming and Scripting

Ascending & Descending order numbers

Dear All, I have below attached file in which i have many nos, i want the last ascending order nos. The brief description is given below. File 315 381 432 315 381 432 315 381 432 315 381 432 315 381 432 (6 Replies)
Discussion started by: pravani1
6 Replies

3. UNIX for Dummies Questions & Answers

Help - Find command with list of files modified descending Order

Hi, I would like to know the command to get the files order in descending order with "FIND" command. Appreciate your help Thanks (4 Replies)
Discussion started by: TonySolarisAdmi
4 Replies

4. UNIX for Dummies Questions & Answers

how to list descending order

Hi, I want to short descending all the files according to their size.Please help me.. (1 Reply)
Discussion started by: jyotidas
1 Replies

5. Shell Programming and Scripting

How to list all the directories, sub directories in a mount along with size in ascending order?

Hi , I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In a particular mount, have to list all the directories and sub directories along with size of the directory and sub directory in ascending order. Please help me in this regard and many... (4 Replies)
Discussion started by: nmakkena
4 Replies

6. Shell Programming and Scripting

Unable to get the correct sort order in perl.

Hi, I have created the hash. %hash; @arr1 = qw(Dealnum AdminStatus adminReason effFrom effTo); @arr2 = qw(121212121 YES 1992-06-19T05:14:27 ); @hash{@arr1}=@arr2; foreach(sort keys %hash){ print "$_ ---- $hash{$_}\n"; } The output i got like this: C:\strawberry\perl\bin>perl... (1 Reply)
Discussion started by: vanitham
1 Replies

7. Shell Programming and Scripting

Help with sort data based on descending order problem

Input file 9.99331e-13 8.98451e-65 9.98418e-34 7.98319e-08 365592 111669 74942.9 0 Desired output 365592 111669 74942.9 7.98319e-08 1.99331e-13 6.98418e-34 (2 Replies)
Discussion started by: perl_beginner
2 Replies

8. Shell Programming and Scripting

script for remove descending order number

hi all i want to remove some descending order number example : 1 100 200 135.00 Gk_wirs 1 1 100 200 136.00 Gk_wirs 50 1 110 210 138.00 Gk_wirs 60 1 100 200 136.00 Gk_wirs 57 ----> how to remove... (6 Replies)
Discussion started by: nithyanandan
6 Replies

9. Shell Programming and Scripting

Sort names in a list by order of importance

Hi, I have multiple list which is arranged by order of importance. I need to do sorting on these lists based on the last name of the user(initial), if user name does not have initial then first name is initial . Important thing is that the last name in the list is important. If there is two or... (1 Reply)
Discussion started by: pratapsingh
1 Replies

10. UNIX for Dummies Questions & Answers

Sorting a file in descending order when you have 10e- values

Hi, I am trying to sort the following file in descending order of its fourth column. 2 1 363828 -2.423225e-03 3 1 363828 4.132763e-03 3 2 363828 8.150133e-03 4 1 363828 4.126890e-03 I use sort -k4,4g -r input.txt > output.txt ... (1 Reply)
Discussion started by: evelibertine
1 Replies
Pod::Find(3pm)						 Perl Programmers Reference Guide					    Pod::Find(3pm)

NAME
Pod::Find - find POD documents in directory trees SYNOPSIS
use Pod::Find qw(pod_find simplify_name); my %pods = pod_find({ -verbose => 1, -inc => 1 }); foreach(keys %pods) { print "found library POD `$pods{$_}' in $_ "; } print "podname=",simplify_name('a/b/c/mymodule.pod')," "; $location = pod_where( { -inc => 1 }, "Pod::Find" ); DESCRIPTION
Pod::Find provides a set of functions to locate POD files. Note that no function is exported by default to avoid pollution of your namespace, so be sure to specify them in the use statement if you need them: use Pod::Find qw(pod_find); From this version on the typical SCM (software configuration management) files/directories like RCS, CVS, SCCS, .svn are ignored. "pod_find( { %opts } , @directories )" The function pod_find searches for POD documents in a given set of files and/or directories. It returns a hash with the file names as keys and the POD name as value. The POD name is derived from the file name and its position in the directory tree. E.g. when searching in $HOME/perl5lib, the file $HOME/perl5lib/MyModule.pm would get the POD name MyModule, whereas $HOME/perl5lib/Myclass/Subclass.pm would be Myclass::Subclass. The name information can be used for POD translators. Only text files containing at least one valid POD command are found. A warning is printed if more than one POD file with the same POD name is found, e.g. CPAN.pm in different directories. This usually indicates duplicate occurrences of modules in the @INC search path. OPTIONS The first argument for pod_find may be a hash reference with options. The rest are either directories that are searched recursively or files. The POD names of files are the plain basenames with any Perl-like extension (.pm, .pl, .pod) stripped. "-verbose => 1" Print progress information while scanning. "-perl => 1" Apply Perl-specific heuristics to find the correct PODs. This includes stripping Perl-like extensions, omitting subdirectories that are numeric but do not match the current Perl interpreter's version id, suppressing site_perl as a module hierarchy name etc. "-script => 1" Search for PODs in the current Perl interpreter's installation scriptdir. This is taken from the local Config module. "-inc => 1" Search for PODs in the current Perl interpreter's @INC paths. This automatically considers paths specified in the "PERL5LIB" environment as this is included in @INC by the Perl interpreter itself. "simplify_name( $str )" The function simplify_name is equivalent to basename, but also strips Perl-like extensions (.pm, .pl, .pod) and extensions like .bat, .cmd on Win32 and OS/2, or .com on VMS, respectively. "pod_where( { %opts }, $pod )" Returns the location of a pod document given a search directory and a module (e.g. "File::Find") or script (e.g. "perldoc") name. Options: "-inc => 1" Search @INC for the pod and also the "scriptdir" defined in the Config module. "-dirs => [ $dir1, $dir2, ... ]" Reference to an array of search directories. These are searched in order before looking in @INC (if -inc). Current directory is used if none are specified. "-verbose => 1" List directories as they are searched Returns the full path of the first occurrence to the file. Package names (eg 'A::B') are automatically converted to directory names in the selected directory. (eg on unix 'A::B' is converted to 'A/B'). Additionally, '.pm', '.pl' and '.pod' are appended to the search automatically if required. A subdirectory pod/ is also checked if it exists in any of the given search directories. This ensures that e.g. perlfunc is found. It is assumed that if a module name is supplied, that that name matches the file name. Pods are not opened to check for the 'NAME' entry. A check is made to make sure that the file that is found does contain some pod documentation. "contains_pod( $file , $verbose )" Returns true if the supplied filename (not POD module) contains some pod information. AUTHOR
Please report bugs using <http://rt.cpan.org>. Marek Rouchal <marekr@cpan.org>, heavily borrowing code from Nick Ing-Simmons' PodToHtml. Tim Jenness <t.jenness@jach.hawaii.edu> provided "pod_where" and "contains_pod". Pod::Find is part of the Pod::Parser distribution. SEE ALSO
Pod::Parser, Pod::Checker, perldoc perl v5.16.2 2012-10-11 Pod::Find(3pm)
All times are GMT -4. The time now is 01:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy