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


Click here to return to the 'poopless perl executable' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
poopless perl executable
Authored by: SOX on Sep 17, '04 04:28:10PM
first the above single line is in fact a perl executable as it is written. but if you want to hide the complexity of this in a file then:

open a terminal window and cut and paste the following into the terminal followed by pressing control-D. The cat > dup_find will create file called dup_find with the rest of the text in it.


cat > dup_find
#!/usr/bin/perl 
# identify duplicates that have same four first fields
$/ = "\r";
while ($d = ) { 
     @F = split /\t/, $d ;
    $x = join " ::\t",@F[0..4]; 
    print $x,"\n" if $h{$x}++;
}

next make it executable:
chmod a+x dup_find

this will run from the command line as:
./dup_find name_of_exported_song_list_file

voila. But as I said the original 1 line perl is executable from the command line and would go nicely inside an applescript

I leave it to you to wrap a dropplet apple_script around the single line command.

[ Reply to This | # ]

Darn html!!!
Authored by: SOX on Sep 17, '04 04:35:31PM
arggh! its so hard to get code to show up right in these comment boxes. The last one was missing the <> symbol since it got removed by the htlp filter.

cat > dup_find
#!/usr/bin/perl 
# identify duplicates that have same four first fields
$/ = "\r";
while ($d = <>) { 
     @F = split /\t/, $d ;
    $x = join " ::\t",@F[0..4]; 
    print $x,"\n" if $h{$x}++;
}



[ Reply to This | # ]