Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using 'wget' to output to multiple files

Status
Not open for further replies.

arunrr

Programmer
Oct 2, 2009
103
0
0
US
I have the following 'inputfile'...


when i use wget as below...

wget -i inputfile

I get 3 files:
schedules?view=all, complete.html, highesttotal.html

I can use the -O option to redirect output to a specific file. For example...

wget -i inputfile -O outputfile

With above, all three output files are concatenated into one file, 'outputfile'.

How may i use wget in the above example to redirect output to 3 different output files: output1, output2, output3

I prefer not to use wget 3 times.

Thanks a ton!
Arun
 
A starting point:
Code:
wget -i inputfile
awk -F/ '{printf "mv \"%s\" output%d\n",$NF,NR}' inputfile | sh

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the reply.

I was more looking for a way to do it via the wget command itself. At the present time, i have a similar script to 'mv' the files to its destination path/filename after the completion of the wget.

This can be accomplished with multiple wget commands and the -O flag as below...

wget -O /home/Schedules/input.data
I prefer not to do the above. Since i am providing the list of URLs via the inputfile and -i flag, I thought there may be away to direct to different output files for different input URLs all with the wget command.

Arun
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top