Last active
November 17, 2015 14:56
-
-
Save ddksr/f3b6fa65f2ea35c1e6e9 to your computer and use it in GitHub Desktop.
Favorite bash snippets
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
# In a file with urls, count different status codes | |
{ for line in `cat urls.txt`; do curl -I $line 2> /dev/null | head -n 1 | egrep -o '[0-9]{3}' ; done; } | sort | uniq -c | |
# Get titles from urls from clipboard | |
urls=`xclip -o | tr '\n' ' '`; for url in $(echo $urls); do clean_url=$(echo -e "${url}" | tr -d '[[:space:]]'); tmp=$(curl "$clean_url" 2> /dev/null | egrep -o '<title>.*</title>' | egrep -o '>.*<'); echo ${tmp:1:-2}; done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment