File processing application
Save as file-report.atom and run atom run file-report.atom -- input.txt. Requires libuv. It reads the complete UTF-8 file before splitting into Unicode-aware lines.
use os
use text
assert(count(os.args) == 1, 'usage: file-report FILE')
filename = os.args[0]
contents = read(filename)
lines = count(text.split(contents, '\n'))
if contents == '':
lines = 0
elif text.ends(contents, '\n'):
lines -= 1
print('{filename}: {lines} lines, {count(contents)} Unicode scalars')