__/ [Dances With Crows] on Sunday 12 February 2006 15:23 \__
> On Sun, 12 Feb 2006 11:55:58 +0000, Roy Schestowitz staggered into the
> Black Sun and said:
>> I am using XMMS. Whenever I press CTRL+ALT+SHIFT+Q, I wish for the
>> currently-listened-to song to be physically deleted. I already have
>> the full path and the filename output to ~/public_html/track.txt . The
>> form is as follows:
>> 11:49 02/12/06
>> , , /media/song_name.mp3,
>> I need to somehow pull the path and filename out of the file and then
>> 'rm' it. My lack of Linux skills prevents me, however, from
>> implementing this.
> This isn't really a Linux problem. This is more of a shell/Perl
> problem. Given a file like that, this is one way. You can do it with
> awk and sed as well--that's an exercise for the reader:
> #!/usr/bin/perl -w
> # assumes filename with track won't change; fix that if necessary
> open(IFP,"/home/me/public_html/track.txt") or die
> "could not open file: $!";
> $line=<IFP>; # we really don't need the date, do we?
> # NOTE: your example had a ' ' in front of the first / . If this is the
> # case with all your track.txt files, you need to uncomment the
> # following line:
> # $file=~s/^ //;
> unlink $file or die "could not unlink \"$file\": $!";
> # end of short barely tested script, save as ~/bin/unlink.pl , chmod +x
> # it, configure xbindkeys to execute it when your key combo is pressed.
> # HTH,
How can I ever thank you enough?
You helped me tremendously and it works perfectly now!