From @avroy
calculating nEvents failed with the following errors:
(standard_in) 1: illegal character: ^M (standard_in) 1: illegal character: ^M
Naively, this is due to carriage return and not uniformly processed across operating systems
See how to handle this:
dos2unix
sed 's/^M//g'