On Sat, 22 Apr 2017 08:08:57 -0700 (PDT)
Vikas Kumar wrote:
> I am trying to iterate over an array, match the lines in a file and
> then delete all occurrences of the lines in the file.
>
> See this example.
> *Array*
> var abcd = [5]string{
> "one two",
> "three four fix",
> "six",
The easiest would be that sed.
Otherwise, do as sed: iterate through the lines with a bufio.Scanner, and write
out libes into a bytes.Buffer iff it doesn't match.
At the end, overwrite the file with buf.Bytes using ioutil.WriteFile.
--
You received this message because you are subscribed to the
Hey All,
I am trying to iterate over an array, match the lines in a file and then
delete all occurrences of the lines in the file.
See this example.
*Array*
var abcd = [5]string{
"one two",
"three four fix",
"six",
"seven eight nine ten",
"eleven twelve thirteen fourteen fif