#!/usr/bin/perl #this program was created by John teBokkel aka Tanj #the program is used to remove "[ebuild N ]" from #the dependency list from `emerge -p packageName > file.txt` #also it removes version information from the end of the ebuild name use strict; our($garbage,$string,$file,$newfile); $file=$ARGV[0]; $newfile=$ARGV[1]; unless($file and $newfile) { die "missing argument\nagr1 source agr2 destination\n"; } open(FILE,"$file") || die "no such file\nagr1 source agr2 destination\n"; open(WORK,">$newfile") || die "could not create file\nagr1 source agr2 destination\n"; while() { $garbage=s/\[(.*?)\]//; s/\-\d(.*?)\n//; $string=$_ . "\n"; if($garbage==1) { print WORK "$string"; } } close FILE; close WORK; print "done\n";