Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    curl https://eblong.com/infocom/ | grep href | grep -v http | cut -d '"' -f2 | awk '{print "curl -O https://eblong.com/infocom/" $0}' | bash -x


Will this overwrite files that have the same name but are in different directories?


I think it would overwrite, but it seems like all the names were unique


that is very clever.

I usually do these sorts of things in a loop, sometimes like:

    <something> | while read f
    do
      sleep 10
      <do-something-with> "$f"
    done


Better make sure there's no spaces in that <something> or that will break.

I usually use this:

  <something> | tr '\n' '\000' | xargs -0 -n1 command
The tr will convert newlines to nulls. Otherwise you need to change the IFS.

Just commenting because this was a bugbear of mine when getting started in bash.


wget has a recursive mode which is perfect for archival




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: