J
john brown
This script receives input from the command line. I put in for
example "www.musicdownload.com/song1.mp3". The script looks for the
".mp3" extension and increments the preceeding number to 10. This
works fine, printing the result to the screen. As you can see, I
would like to write the results to a file called "wget_input". Wget
reads from this file and the songs are retrieved. The problem I have
is with writing all of the results to the file, in this
case/www.musicdownload.com/song10.mp3" gets written to the file only.
I know it must be incremented and written after each result, but I
don't know how to go about constructing the loop. Any ideas?
#! /usr/bin/perl -w
#
# mp3_search
#
print "Input path to video archive\n";
$stdinput = <STDIN> ;
chomp ($stdinput);
$path = "$stdinput";
$count = substr ($path, rindex ($path, ".mp3") - 1, 1);
for ($count .. 10)
{ substr ($path, rindex ($path, ".") - 1, 1, $count++); print
"$path\n"; }
open (OUTPUTFILE,">wget_input")|| die "Failed to open
wget_input\n";
printf OUTPUTFILE "$path";
close OUTPUTFILE;
example "www.musicdownload.com/song1.mp3". The script looks for the
".mp3" extension and increments the preceeding number to 10. This
works fine, printing the result to the screen. As you can see, I
would like to write the results to a file called "wget_input". Wget
reads from this file and the songs are retrieved. The problem I have
is with writing all of the results to the file, in this
case/www.musicdownload.com/song10.mp3" gets written to the file only.
I know it must be incremented and written after each result, but I
don't know how to go about constructing the loop. Any ideas?
#! /usr/bin/perl -w
#
# mp3_search
#
print "Input path to video archive\n";
$stdinput = <STDIN> ;
chomp ($stdinput);
$path = "$stdinput";
$count = substr ($path, rindex ($path, ".mp3") - 1, 1);
for ($count .. 10)
{ substr ($path, rindex ($path, ".") - 1, 1, $count++); print
"$path\n"; }
open (OUTPUTFILE,">wget_input")|| die "Failed to open
wget_input\n";
printf OUTPUTFILE "$path";
close OUTPUTFILE;