Re: [go-nuts] Re: Golang Grep

2016-06-23 Thread Steven Blenkinsop
Sorry for the late reply, I've been having a busy week. Hopefully you've figured it out by now. If not, I'll point out that the "grep" function doesn't return its results, it prints them out. I've restructured it to make it more general purpose, so that you can use the results in other code: https

Re: [go-nuts] Re: Golang Grep

2016-06-15 Thread ToSuNuS
Hi Steven, I want to use a word that the data from this function. for example; f := func() { grep(flag.Arg(0), flag.Arg(1)) } if f == "domain.com" { } or handle := exec.Command("echo", string(f[1])).Output() Examples of these subject. My purpose is to convert the string. Regards. On Wedne

Re: [go-nuts] Re: Golang Grep

2016-06-15 Thread Steven Blenkinsop
Oh, sorry, didn't see that. `grep` doesn't return a value, so there's nothing to assign to a variable. What are you trying to do exactly? If you want a function value you can call repeatedly which will pass the same arguments to `grep`, you want: f := func() { grep(flag.Arg(1), flag.Arg(2)) }

[go-nuts] Re: Golang Grep

2016-06-15 Thread ToSuNuS
Hi, I forgot to mention. I'm new to this. Regards. On Wednesday, June 15, 2016 at 6:54:18 PM UTC+3, ToSuNuS wrote: > > Hi guys, > > How do I assign a variable function of sample scripts are used on the > following address? > > > https://github.com/StefanSchroeder/Golang-Regex-Tutorial/blob/mas

[go-nuts] Re: Golang Grep

2016-06-15 Thread ToSuNuS
Hi Steven, I mistyped the opening question. However, the script has been added correctly. Of course, the result is still the same. I run the command. go run test.go testword /root/testfile.txt Result: grep(flag.Arg(0), flag.Arg(1)) used as value I just add the following code. (to test)