Skip to content

Instantly share code, notes, and snippets.

@austinogilvie
Created November 3, 2013 03:30
Show Gist options
  • Select an option

  • Save austinogilvie/7286342 to your computer and use it in GitHub Desktop.

Select an option

Save austinogilvie/7286342 to your computer and use it in GitHub Desktop.
#!/bin/bash
COUNTER=1
for line in $(cat list_of_extreme_sports.txt); do
url=$(echo "$line" | cut -d'|' -s -f2) # split on pipe sep and take 2nd col
if [ ! -z "$url" -a "$url" != " " ]; then # ensure not empty string.
if [[ "$url" == http* ]]; then # check that it starts with http
OUTFILE="outfile_${COUNTER}"
~/Workspace/Repositories/opensource/table2csv/table2csv/table2csv $url --save $OUTFILE
COUNTER=$((COUNTER + 1)) # bump the counter += 1
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment