Re: Learning Unix
Posted: Mon May 04, 2009 6:38 pm
Code: Select all
#!/usr/bin/sh
find -regex '.*/\(SCCS\|RCS\|\.[A-Za-z0-9_]\).*' -prune -or -type l -or -type f | xargs egrep --binary-files=without-match -I "$@" /dev/null
If you're still going ham and getting it, don't let up.
https://jonathan.pearce.name/mohtalim/
https://jonathan.pearce.name/mohtalim/viewtopic.php?f=2&t=269
Code: Select all
#!/usr/bin/sh
find -regex '.*/\(SCCS\|RCS\|\.[A-Za-z0-9_]\).*' -prune -or -type l -or -type f | xargs egrep --binary-files=without-match -I "$@" /dev/null
Code: Select all
#!/usr/bin/perl
$optpct = 0;
$optcum = 0;
my $total = 0;
while(<>) {
next if m/^#/;
next if m@^/@;
if( m/^(\d+)\s+(.+)/) {
$table{"$2\n"} += $1;
$total += $1;
} else { # assume single instance
$table{$_} += 1;
$total += 1;
}
}
my $val = 0;
for $key (sort { $table{$b} <=> $table{$a} } keys %table) {
$pct = sprintf("%f", ( 100*($table{$key} / $total)));
$tmp = $optpct ? $pct : $table{$key};
if ($optcum) {
$val += $tmp;
} else{
$val = $tmp;
}
print "$val\t$key";
}