Hello everyone! Help me guys i come from C language programming so on first time my brain exloded.
I ha ve simple target. I have a dump file (its utf8 file) in which i must replace all word “astrakhanzapoved.ru” to “127.0.0.1”. How to do it?
I wrote this code
defmodule Filereader do
def parse do
File.stream!("dump")
|> Stream.map(&(IO.inspect(&1)))
|> Stream.run
|>perfomandwrite()
end
def perfomandwrite(a) do
b=Elixir.String.replace(a, "http://astrakhanzapoved.ru", "http://127.0.0.1")
{:ok, file}=File.open "out", [ :append]
IO.write file,b
File.close file
end
end
Its compiled but not work. What i doing wrong?