Re: [go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-28 Thread Michael Jones
Great! On Fri, Apr 28, 2017 at 6:14 PM, Vikas Kumar wrote: > Thanks again Michael and Ishan. My git-hook is completed now, running > perfectly :) > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop re

Re: [go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-28 Thread Vikas Kumar
Thanks again Michael and Ishan. My git-hook is completed now, running perfectly :) -- 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...@google

Re: [go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-25 Thread Michael Jones
Sure. Here's a slightly expanded example. https://play.golang.org/p/bfKFrATI0q On Tue, Apr 25, 2017 at 5:20 AM, Vikas Kumar wrote: > Thanks a ton Michael and Ishan. Let me understand the code and use this in > my program. > > Cheers, > Vikas > > -- > You received this message because you are sub

Re: [go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-25 Thread Vikas Kumar
Thanks a ton Michael and Ishan. Let me understand the code and use this in my program. Cheers, Vikas -- 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

Re: [go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-23 Thread Michael Jones
...or if you copy the strings.Contains() comparison to the test, it echoes the program with six and each of the patterns removed. On Sun, Apr 23, 2017 at 7:57 AM, Michael Jones wrote: > Another example: > https://play.golang.org/p/hDKQtwHo6M > > In this case, just copy the program to your machin

Re: [go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-23 Thread Michael Jones
Another example: https://play.golang.org/p/hDKQtwHo6M In this case, just copy the program to your machine and build it. i called it lines.go when i run it as: lines < lines.go it echos the program with the line "six" removed On Sun, Apr 23, 2017 at 12:47 AM, Ishan Jain wrote: > You can do it

[go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-23 Thread Ishan Jain
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

[go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-23 Thread Ishan Jain
You can do it like this. I wrote the code to filter out lines from an array that does not contain words specified in array. package main > > import ( >"os" >"log" >"bufio" >"io" >"regexp" > ) > > var abcd = [5]string{ >"one two", >"three four fix", >"six", >"s

[go-nuts] Re: Find a string in a file and delete all occurences in the file

2017-04-23 Thread Vikas Kumar
Thanks Tamás, I am looking something in a Golang way so that I can create a binary and distribute it in the team which has some Windows users as well. Thanks for the pointers. Let me try it out. On Sunday, 23 April 2017 17:06:42 UTC+10, Tamás Gulácsi wrote: > > The easiest would be that sed. >