0

I have a csv called test.csv that contains urls to be dowloaded in its first column. I want to download the urls using wget. How can I do this in shell?

I have used the command below but no success:

awk -F ',' '{print $1}' test.csv | wget -P download_dir
Cyrus
  • 84,225
  • 14
  • 89
  • 153
Hosein Basafa
  • 1,068
  • 8
  • 11

1 Answers1

0

I don't think you can pipe the filenames into wget, but you can run the command for each item with the filename appended to the end

try this and review the list of commands it will run

awk -F ',' '{print $1}' test.csv | xargs -n1 echo wget -P download_dir

then remove echo and run it again, and it'll execute the commands instead of printing them

Alex028502
  • 3,486
  • 2
  • 23
  • 50