Skip to content

Instantly share code, notes, and snippets.

@jtbrough
Created July 22, 2014 22:35
Show Gist options
  • Save jtbrough/54968c685fc28d00eda5 to your computer and use it in GitHub Desktop.
Save jtbrough/54968c685fc28d00eda5 to your computer and use it in GitHub Desktop.
#!/bin/bash
filename=~/path/to/shortened_input.txt
exec 4<$filename
while read -u4 p ; do
expanded=$(curl -sI $p | sed -n 's/Location: *//p')
if [ ${#expanded} > 0 ]
then
echo $expanded >> ~/path/to/expanded_output.txt;
else
echo $p >> ~/path/to/expanded_output.txt;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment