Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.5: View the new 'man' pages on upgraded systems' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: View the new 'man' pages on upgraded systems
Authored by: yuji on Dec 13, '07 09:07:14AM
Here's my version of the perl script. Save it in a file (say remove_duplicates.pl), cd to /usr/share/man, and sudo perl remove_duplicates.pl. It just backs up the old man pages in /usr/share/man/duplicates/ , and never removes it.

use File::stat;
mkdir "duplicates" unless -e "duplicates";
for $dir (<man*>){
	unless(-e "duplicates/$dir"){
		mkdir "duplicates/$dir";
	}
	($id)=($dir=~/man(.*)/);
	for(<$dir/*.$id>){
		if(-e "$_.gz"){
			$st=lstat($_);
			$gz=lstat("$_.gz");
			if($st->mtime < $gz->mtime ){
				print "$_ older than $_.gz \n";
				rename $_, "duplicates/$_";
			}
		}
	}
}


[ Reply to This | # ]