Search commandlinefu from the command line

(curl -d q=grep | egrep 'autocomplete|votes|destination' | perl -pi -e 's/a style="display:none" class="destination" href="//g;s/<[^>]*>//g;s/">$/\n\n/g;s/^ +//g;s/^\//http:\/\/\//g'
There's probably a more efficient way to do this rather than the relatively long perl program, but perl is my hammer, so text processing looks like a nail. This is of course a lot to type all at once. You can make it better by putting this somewhere: clf () { (curl -d "q=$@" 2>/dev/null) | egrep 'autocomplete|votes|destination' | perl -pi -e 's/<a style="display:none" class="destination" href="//g;s/<[^>]*>//g;s/">$/\n\n/g;s/^ +|\([0-9]+ votes,//g;s/^\//http:\/\/\//g'; } Then, to look up any command, you can do this: clf diff This is similar to except that it's just one line, so more in the spirit of CLF, in my opinion.
Sample Output
grep --color=auto -iRnH "$search_word" $directory

Grep for word in directory (recursive)        

grep -i --color=auto

Grep colorized        

By: isaacs
2009-07-08 22:10:49

What Others Think

#!/bin/sh protocol="http" primeurl="" fulltext="fulltext=Search&" google=" domains="domains="$lng$primeurl"&" sitesearch="sitesearch="$lng$primeurl"&" btnI="btnI=I%27m+Feeling+Lucky&" gl="gl=us&" q="q="$@ baseurl=$google$domains$sitesearch$fulltext$gl$btnI$q if [ "$1" == "-g" ] then google=" domains="domains="$lng$primeurl"&" sitesearch="sitesearch="$lng$primeurl"&" btnI="btnI=I%27m+Feeling+Lucky&" gl="ql=us&" shift q="q="$@ baseurl=$google$domains$sitesearch$fulltext$gl$q fi url=$protocol://$baseurl open "$url" # `open' is MacOSX specific command ---------------
commandlinefu · 629 weeks ago
curl -sd q=grep |html2text
commandlinefu · 629 weeks ago
No html tags I guess!
commandlinefu · 629 weeks ago
No html tags I guess!
commandlinefu · 629 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: