-
-
Save virtualsafety/7c55d7872017e559fb45ab124a64470f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io/ioutil" | |
"log" | |
"strings" | |
) | |
func main() { | |
input, err := ioutil.ReadFile("myfile") | |
if err != nil { | |
log.Fatalln(err) | |
} | |
lines := strings.Split(string(input), "\n") | |
for i, line := range lines { | |
if strings.Contains(line, "]") { | |
lines[i] = "LOL" | |
} | |
} | |
output := strings.Join(lines, "\n") | |
err = ioutil.WriteFile("myfile", []byte(output), 0644) | |
if err != nil { | |
log.Fatalln(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment