Wednesday, July 6, 2011

FUCK i love grep

grep -o has saved me soooo many times.

Here is an example of it, I am using curl to grab the last 5 links from a twitter page:
curl -s| grep "" | sed 's/.*\(.*\)<\/text>.*/\1/' | grep -o "http://pastebin.* "
without the grep -o section, it would simply return the tweet as one line with you needing to pull out the links somehow.

Just be careful, because i discovered that twitter only allows you to pull 150 tweets in an hour on some accounts.

No comments:

Post a Comment