Created
August 15, 2013 13:35
-
-
Save heypano/6240849 to your computer and use it in GitHub Desktop.
sorts ls results by permission - Useful for finding similar files or folders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
my @entries = reverse sort by_first_column `ls -la @ARGV`; | |
print @entries; | |
sub by_first_column{ | |
(my $a1 = $a) =~ s/^[\s]*([\S]+).+$/$1/; | |
(my $b1 = $b) =~ s/^[\s]*([\S]+).+$/$1/; | |
return $a1 cmp $b1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment