I created a small program to demonstrate this. As go playground doees not supports files and stuff so I put all the content of file in an array and iterated through that. You can read the file and iterate through ReadBuffer Line by line to get the same results.
Go playground link: https://play.golang.org/p/6VmgwnsAag Please let me know if there is something you didn't understood in my code. Btw, I posted a reply at 1'O clock Indian Standard Time. Don't know what happened to that. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.