Created
June 13, 2018 16:47
-
-
Save christopherlovell/aa60ea6477594953892f28e51b56729f to your computer and use it in GitHub Desktop.
Create list of URLs for wget from SDSS DR7 spec info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Clear output file | |
> out.csv | |
while read f; do | |
# read in line to array, comma delimited | |
arrIn=(${f//,/ }) | |
printf -v plate "%04d" ${arrIn[0]} | |
printf -v mjd "%05d" ${arrIn[1]} | |
printf -v fiber "%03d" ${arrIn[2]} | |
# Example: http://das.sdss.org/raw/spectro/1d_26/0308/1d/spSpec-51662-0308-640.fit | |
out="http://das.sdss.org/raw/spectro/1d_26/$plate/1d/spSpec-" | |
out="$out$mjd-$plate-$fiber.fit" | |
echo $out >> out.csv | |
done < <(tail -n+2 result.csv) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment