public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* 2.10.0: Cygwin now can not work well with a file in dos format.
@ 2018-06-15 16:19 tuyanyi
  2018-06-15 19:46 ` Soegtrop, Michael
  2018-06-15 22:50 ` cyg Simple
  0 siblings, 2 replies; 10+ messages in thread
From: tuyanyi @ 2018-06-15 16:19 UTC (permalink / raw)
  To: cygwin

Hi,
I've faced a problem when deal with a text file now, the old version work very well, but the new version, it wont.

1, There is a file named test.txt which in dos format(CRLF), and the content is as follows,
456467987564654654
456467987564654654
456467987564654654
456467987564654655
456467987564654656
456467987564654657
456467987564654658
456467987564654659
456467987564654660
456467987564654661
456467987564654662
456467987564654663
456467987564654664
456467987564654665

I've written a awk script named stat.awk to count each line of test.txt.
#!/bin/awk -f
BEGIN {
	list[""] = ""
	delete list
}
{
	list[$0]++
}
END {
	for(l in list)
	{
		print l ":" list[l]
	}
}

In cygwin 2.874, the output is correct.
$ ./stat.awk test.txt
456467987564654659:1
456467987564654660:1
456467987564654661:1
456467987564654662:1
456467987564654663:1
456467987564654654:3
456467987564654664:1
456467987564654655:1
456467987564654665:1
456467987564654656:1
456467987564654657:1
456467987564654658:1

But, in version 2.10.0, the output is as follows, it's not what I want.
$ ./stat.awk test.txt
:16467987564654663
:16467987564654658
:16467987564654664
:16467987564654659
:36467987564654654
456467987564654665:1
:16467987564654660
:16467987564654655
:16467987564654661
:16467987564654656
:16467987564654662
:16467987564654657

Finally, I run dos2unix to convert this file into unix format, and then run stat.awk, and this time the output is correct.
$ ./stat.awk test.txt
456467987564654659:1
456467987564654660:1
456467987564654661:1
456467987564654662:1
456467987564654663:1
456467987564654654:3
456467987564654664:1
456467987564654655:1
456467987564654665:1
456467987564654656:1
456467987564654657:1
456467987564654658:1

I was wonder, what have changed between version 2.10.0 and 2.874,  or is it possible to modify a configure to fix this in 2.10.0?

By the way, my OS is Window 7 64bit, and I installed a 64bit Cygwin with version 2.10.0 .

Thank you very much!

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-06-16 20:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-15 16:19 2.10.0: Cygwin now can not work well with a file in dos format tuyanyi
2018-06-15 19:46 ` Soegtrop, Michael
2018-06-15 23:50   ` cyg Simple
2018-06-16  0:49   ` Brian Inglis
2018-06-16 14:10   ` Michel LaBarre
2018-06-16 15:21     ` Marco Atzeri
2018-06-16 20:25     ` Soegtrop, Michael
2018-06-16 20:34       ` Michel LaBarre
2018-06-17  1:13       ` cyg Simple
2018-06-15 22:50 ` cyg Simple

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).