Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- COPY xx_table ... FROM stdin
- 4 33380 N N
- 4 33380 N N
- .
- IO.stream(:stdio, :line)
- |> Stream.transform(false, fn line, skipping ->
- cond do
- !skipping && String.starts_with?(line, "COPY") -> {[{true, line}], true}
- skipping && line == "\.n" -> {[{true, line}], false}
- true -> {[{skipping, line}], skipping}
- end
- end)
- |> Stream.filter(fn {skipping, _} -> !skipping end)
- |> Stream.map(fn {_, line} -> line end)
- |> Stream.into(IO.stream(:stdio, :line))
- |> Stream.run()
- IO.stream(:stdio, :line)
- |> Stream.into(IO.stream(:stdio, :line))
- |> Stream.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement