Created
December 18, 2020 03:41
-
-
Save yfuruyama/1458aad949c5f89f0e3cf5715b579ed1 to your computer and use it in GitHub Desktop.
This file contains 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 ( | |
"encoding/csv" | |
"io" | |
"log" | |
"os" | |
) | |
func main() { | |
reader := csv.NewReader(os.Stdin) | |
reader.Comma = '\t' | |
reader.LazyQuotes = true | |
writer := csv.NewWriter(os.Stdout) | |
for { | |
record, err := reader.Read() | |
if err == io.EOF { | |
break | |
} | |
if err != nil { | |
log.Fatalf("unexpected error on read: %v", err) | |
} | |
if err := writer.Write(record); err != nil { | |
log.Fatalf("unexpected error on write: %v", err) | |
} | |
} | |
writer.Flush() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment