
Twitter one liner
With all this talk of Twitter from the command line, I thought I'd throw out a one liner to see the last 20 Tweets that my friends have posted.
curl --basic --silent --user user:password --get http://twitter.com/statuses/friends_timeline.xml | sed --quiet --expression='s/<name>\(.*\)<\/name>/\1/p' --expression='s/<text>\(.*\)<\/text>/\1/p'
Notice, that's all on one line, but was broken in two to fit on the screen.
There are other ways to do this, Perl would probably be my favorite. I used curl and sed here just because I tend to always fall back on Perl and I wanted to try something different. Also, Perl requires the LWP module to duplicate the curl functionality. grep could also have been used instead of sed.
I invite you all to play with this and post any other Twitter one liners here.
Here is a link to the Twitter API:
http://groups.google.com/group/twitter-development-talk/web/api-document...
Chris

Dude that is sick:) Thanks
Dude that is sick:)
Thanks Chris you the man!
Add a little Perl
OK, this isn't quite so eligant, but the only way I could come up with getting the name and Tweat on the same line in a logical order was to use a variable in Perl:
curl --basic --silent --user user:password --get http://twitter.com/statuses/friends_timeline.xml | perl -ne 'if(m/<text>(.*)<\/text>/){$text=$1;}if(m/<name>(.*)<\/name>/){print $1,"--> ",$text,"\n";}'
Chris