newline - wc -l returning 0 on a non-empty file -


i downloaded json file using curl on server https://api.data.gov/ed/collegescorecard/v1/schools?api_key=[my_api_key]

(i have uploaded file tinyupload if want play around it.)

the downloaded file 1.5mb , has large (and valid) json object. however, on server when run command wc -l against file, returns 0. running wc -c returns correct byte count.

i opened file in textedit , looked fine. did notice man wc on server (centos 5.5) , man wc on mac (yosemite) seem have different descriptions -l flag does:

centos 5.5:

print newline counts

osx 10.10.5 yosemite

the number of lines in each input file written standard output.

which manual correct? wc -l count lines or new lines? if count lines , not new lines, there ever case when wc -l return 0 when there line in file?

is possible mark's comment regarding windows based characters on this related post correct diagnoses? ran cat -vet against file, couldn't find ^m using grep, , it's way text manually search.

the manpage on os x says (first paragraph in description):

a line defined string of characters delimited < newline> character.

so there no contradiction between 2 versions of mangpages.

since file not have newline, wc -l correctly returns 0.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

android - Go back to previous fragment -