Working random fact generator

wget randomfunfacts.com -O - 2>/dev/null | grep \<strong\> | sed "s;^.*<i>\(.*\)</i>.*$;\1;"
Though without infinite time and knowledge of how the site will be designed in the future this may stop working, it still will serve as a simple straight forward starting point. This uses the observation that the only item marked as strong on the page is the single logical line that includes the italicized fact. If future revisions of the page show failure, or intermittent failure, one may simply alter the above to read. wget randomfunfacts.com -O - 2>/dev/null | tee lastfact | grep \<strong\> | sed "s;^.*<i>\(.*\)</i>.*$;\1;" The file lastfact, can then be examined whenever the command fails.

2 Alternatives + Submit Alt

  • extension to tali713's random fact generator. It takes the output & sends it to notify-osd. Display time is proportional to the lengh of the fact.


    2
    wget randomfunfacts.com -O - 2>/dev/null | grep \<strong\> | sed "s;^.*<i>\(.*\)</i>.*$;\1;" | while read FUNFACT; do notify-send -t $((1000+300*`echo -n $FUNFACT | wc -w`)) -i gtk-dialog-info "RandomFunFact" "$FUNFACT"; done
    mtron · 2010-04-02 09:43:32 1
  • This is a working version, though probably clumsy, of the script submitted by felix001. This works on ubuntu and CygWin. This would be great as a bash function, defined in .bashrc. Additionally it would work as a script put in the path. Show Sample Output


    0
    lynx -dump randomfunfacts.com | grep -A 3 U | sed 1D
    xizdaqrian · 2009-05-05 07:52:10 8

What Others Think

Pretty cool. I would just change a couple of things. You can use the -q option with wget rather than redirecting stderr to /dev/null. Sed can also do the job of the grep. wget randomfunfacts.com -qO- | sed -n "/<strong>/{s;^.*<i>\(.*\)</i>.*$;\1;p}" Or versions of grep that support PCRE can do the job of the sed: wget randomfunfacts.com -qO- | grep -Po '(?<=<strong><i>)[^<]+(?=</i></strong>)'
eightmillion · 610 weeks and 1 day ago
sell my car Buffalo ny Are you looking to sell your junk car for cash in Buffalo, NY-Buffalo Junkyard provides the best cash offer with free towing service in Buffalo and surrounding areas. https://bobscashforjunkcarsbuffalony.com/
KayGasaway · 5 weeks and 5 days ago
I got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. click here
KayGasaway · 5 weeks and 4 days ago
Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. https://www.financehelper.net/
KayGasaway · 5 weeks and 4 days ago
Gambling website 789bet or 789betting is the best online gambling website and legal online casino service, providing online gambling services, online football betting, online slots, online lottery, online baccarat, online games, full range, full range, high return, link system to get wealth. Top 789
KayGasaway · 5 weeks and 3 days ago
Best Engine Oil Beyond Performances is an Amsoil Dealer that provides the best Amsoil diesel oil, amsoil motor oil, best transmission fluid, and engine lubricants. https://beyondperformances.com/
KayGasaway · 5 weeks and 2 days ago
The Best facial review in East coast Sg ?- Perfect Beauty Bedok. Skin Origins Centre, The best facial in Bedok is at Perfect Beauty Bedok Established in 2001 Qualified beauticians using SkinOrigins and Phyris. Call Us Mobile: +6593895687 or visit our website, Thank You.
KayGasaway · 4 weeks and 6 days ago
Treat saggy eyelids & hooded eyes with EvenSkyn Venus Eyelid Anti Aging device Every successive use of the EvenSkyn:registered: Venus helps with deeper penetration of anti-aging eye serums & creams, resulting in firmer and tighter eyelid skin. http://www.sourcecode.se/sokoban/node/635?page=1#comment-3517">EvenSkyn Venus Eyelid Anti Aging device
KayGasaway · 4 weeks and 6 days ago
Vesco Pharma Placenta Injection ?C 1000 contains a high-quality placenta extract as a base ingredient, which gives it an abundance of therapeutic potential for the body. The placenta is a temporary organ found in a female expecting, where the unborn baby grows. Hence, it contains many vital enzymes, growth factors, peptides, minerals, and vitamins that may benefit the body.
KayGasaway · 4 weeks and 6 days ago
Get True Reviews for the Online Products by Inidan review website, Check Revexpo for more info, It is one of the True best reviews Website in India provides genuine reviews from online buyers their experience.
KayGasaway · 4 weeks and 4 days ago
Are you concerned about the condition of your home Call us today to schedule a mold inspection Columbus Ohio! Our experts can be reached 1 800 241 0133, Mold Inspection in Columbus Ohio - Schedule an Appointment Now!
KayGasaway · 4 weeks and 3 days ago
The UK ECIG STORE has the best range of vape devices and e liquids including starter ecig kits and pod vape kits We offer FREE UK delivery. Sign up to our newsletter today and receive 10% OFF your first order. You can unsubscribe at any time. Want to know what you need to start vaping? What a pod kit is? Please click here and get all these details. Thank You. http://clashofclansbuilder.com/forums/thread/387180">here
ayesha · 4 weeks and 2 days ago
If You are looking for BIM modeling Services which includes, Architectural Rendering, Architectural drafting, BIM Objects, MEP Modeling and Building Modeling, Please visit this url Team4bim offers very low prices and we provide services fast with good quality standards, We provide an up-front quotation on the complete project so you’ll know the total cost without any surprises. BIM modeling
KayGasaway · 3 weeks and 4 days ago
Explore KC Hemp Co ® is Kansas City's most trusted source for CBD Products Offering CBD gummies, CBD oil tinctures, CBD Pain Relief Lotion, and the best Delta 8 gummies in KC. buy cbd online Unsure which CBD Product is best for you? Take our short Quiz to find today. Visit our website Thank You. buy cbd online
KayGasaway · 3 weeks and 3 days ago
Explore Weight loss ?on Diet Eating - we provide Healthy Food and Recipes for You. Visit our website for more Details. Thank you.
KayGasaway · 3 weeks and 3 days ago
Explore Viking range repair in Orange ?County - Viking Range Corporation is an appliance company that manufactures high-end professional kitchen appliances for residential and commercial use
KayGasaway · 3 weeks and 3 days ago
No.1 Best Indonesia company incorporation ?Services | Company Registration Service in Indonesia Explore A Comprehensive Guide to All You Need to Know About Starting a Business
KayGasaway · 3 weeks and 3 days ago
Best ERISA attorney las vegas ?- Law Office of Julie Mersch, Call Julie Mersch Law at 702 387 5868 nevada long term disability lawyer near you Expert Attorney Over 20 years of experience She offers premium legal services, Visit our website and find out how we can fight for you. Thank You.
KayGasaway · 3 weeks and 3 days ago
If You are looking for securities attorney , Mdf Law has Decades of Legal Experience with Proven track record. Our attorneys represent investors in securities fraud claims pursued in state and federal court. These claims generally allege fraud made in connections with the offer or sale of a security. Kindly visit our for more info, Thank You. website
KayGasaway · 3 weeks and 2 days ago
Selain itu anda juga bisa bermain permainan judi uang asli Betflix ?dari berbagai platform pilihan anda, baik dari hp, laptop, komputer atau bahkan tablet anda semua bisa dilakukan hanya bermodalkan internet dan browser dari perangkat anda
KayGasaway · 2 weeks and 6 days ago
By US FDA regulations , you always need a FDA Prior Notice confirmation before the shipment enters the US to avoid abandonments, returns or delays.Now it is easy to get FDA Prior Notice Form & FDA Approval for less than $1, Buy 2 Get 1 Free . Automatic free credit topup to account . No code require . Click here to explore this offer. FDA Prior Notice
KayGasaway · 2 weeks ago
All your hard work is much appreciated. Nobody can stop to admire you. Lots of appreciation. http://www.ottawatirewholesalers.com">Tires Ottawa
KayGasaway · 1 week and 6 days ago
–Are your clients familiar using the web, do they utilize it routinely? APLICARE ONLINE DE VIZA INDIAN?
wenilak444 · 23 hours ago
–Are your clients familiar using the web, do they utilize it routinely? APLICARE ONLINE DE VIZA INDIAN?
wenilak444 · 23 hours 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?

commandlinefu.com 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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: