Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using CRLF on Windows for new line #1

Open
jftuga opened this issue Jul 13, 2020 · 2 comments
Open

Consider using CRLF on Windows for new line #1

jftuga opened this issue Jul 13, 2020 · 2 comments

Comments

@jftuga
Copy link
Contributor

jftuga commented Jul 13, 2020

On Windows, if you want to get an exact copy, consider using CRLF new lines...

		// Keep writing to the same file, increment counter
		line := fmt.Sprintf("%s\r\n", scanner.Text())
		if _, err := fmt.Fprintf(currentFile, line); err != nil {
			log.Fatal("error writing to file:", err)
		}

This way, when you want to verify all of the parts are equal to the original file:

file-spliter.exe -l 1500 -f big.csv
cd parts
copy /b part_1.csv + /b part_2.csv + /b part_3.csv + /b part_4.csv the_same.csv
md5sum the_same.csv ..\big.csv

Now, the_same.csv and big.csv will have matching MD5 checksums.

Of course, you wouldn't want to do this for files that only use CR for new lines.

@lfourky
Copy link
Owner

lfourky commented Jul 16, 2020

Of course, you wouldn't want to do this for files that only use CR for new lines.

So, how should the check look like before I insert a \r code?

I'm fine with being more correct about what goes into smaller parts of the file, I'm just not sure how the fix should look like. :)

@jftuga
Copy link
Contributor Author

jftuga commented Jul 17, 2020

I created a PR for this.

#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants