Nov
24th
2008
Mon
24th
2008
Ugly hack to fold path names into file names
I want to go from ../www.fda.gov/medwatch/SAFETY/2003/03AUG_PI/Advair Diskus_PI.pdf to 2003_-_03AUG_PI_-_Advair Diskus_PI.pdfI came up with this hack:
find ../www.fda.gov/ -name '*_PI*pdf' > names_a find ../www.fda.gov/ -name '*_PI*pdf' | \ sed -e 's/.*safety\/\(.*\)/\1/gi' -e 's/\//_-_/g'> names_b paste names_a names_b | ~/src/misc/to_tsv.py -0 \' | \ xargs -l1 ln(The to_tsv.py script is used to wrap the filenames in quotes.) I guess a quick Python script would have been better…